I am currently learning Angular 2 and have a component called Register. Within this single component, I have five different HTML pages. Is it possible to have multiple templates per component in order to navigate between these pages? How can I implement routing while keeping each page's HTML and SCSS separate? That is my main goal.
Right now, I am using ngIf
to render the pages, but this has made my code quite lengthy. Are there any alternative approaches to achieve the same functionality?
<!--View 1-->
<div class="open-card-BG" *ngIf="registerView=='regView1'">
Register Page 1
</div>
<!--View 2-->
<div class="open-card-BG" *ngIf="registrationView=='regView2'">
Register Page 2
</div>
@Component({
selector: 'register-page',
templateUrl: './register-page.component.html',
styleUrls: ['./register-page.component.scss'],
providers : [RegisterService,Configuration,LocalStorageService]
})
ngOnInit() {
this.registerView= "regView1";
}
changeView(view) {
this.registerView= view;
}
previousView(view) {
this.registerView= view;
}