There are two primary ways to achieve this: utilizing a router outlet as demonstrated in the Tour of Heroes example provided here.
In this scenario, you will have to configure all your routes (path, name...):
<a [routerLink]="['Page1']">Page 1</a>
<a [routerLink]="['Page2']">Page 2</a>
<router-outlet></router-outlet>
UPDATED : Another option is manually hiding your component in your app html code.
// Experiment with both solutions, ngIf might encounter difficulties regenerating the DOM for display
<app-pageContact [class.hidden]="!(page === 'Contact')"></app-contact>
<app-pageContact *ngIf="page === 'Contact'"></app-contact>
// Within your code, simply adjust this value based on the clicked button
<button (click)="changePage('Contact')">Contact us</button>
In your app.component.ts, create the changePage method that can modify the page variable's value:
changePage(pageName: string) {
this.page = pagename;
}
/!\ In this instance, the more complex your code becomes, the harder it may be to comprehend, which is why I still recommend using routing over manual manipulation.