Для отображения следующего компонента после нажатия на кнопку. Вам необходимо использовать EventEmitter.
EventEmitter - это путь к дочернему компоненту, который может взаимодействовать с его родительским компонентом.
Angular Документы отправителя событий
Ниже объясняется, как использовать EventEmitter в этом случае.
Мое решение доступно здесь: Решение по Stackblitz
census.component.ts
import { Component, EventEmitter, Output } from '@angular/core';
@Component({
selector: 'app-census',
templateUrl: './census.component.html',
})
export class CensusComponent {
@Output() next: EventEmitter<string> = new EventEmitter();
getSection(){
// after clicking on getSection we need to emit the value
// that the parent componente will receive
this.next.emit('count2'); // <- emit count2
}
}
your-data.component.html
<div class='container'>
<div class='row'>
<div class='setup-content'>
<h1>Confirm Data/Answer Questions</h1>
<p>Please answer all questions below. If you have questions about the data provided on this screen, please contact << Broker >> at << Phone >> or << Email >>.</p>
<div [ngSwitch]=count>
<!-- here app-census pass the value to the parent component
through onNext method ($event is the string value emitted
before)
-->
<app-census
(next)="onNext($event)" *ngSwitchCase="'count1'"></app-census>
<app-application *ngSwitchCase="'count2'"></app-application>
</div>
</div>
</div>
</div>
your-data.component.ts
import { Component, ViewEncapsulation} from '@angular/core';
@Component({
selector: 'app-your-data',
templateUrl: './your-data.component.html'
})
export class YourDataComponent {
count: string = 'count1';
onNext(count: string) {
// parent component receives the value emitted by
// census component and it stores the value in
// this.count
this.count = count;
// now this.count is count2 and application component will be shown
}
}