I am new to Angular framework and creating an angular application. And I have a layout(Header, Body , Footer) where Header and footer should be fixed and they are placed in app.component.html. Only the body needs to be changed based on the click or navigation. So but right now, I am struck with one issue.
App.component.html
<app-header></app-header>
<router-outlet></router-outlet>
<!-- Footer Selector-->
<app-footer></app-footer>
dashboard component
<div class="container-fluid">
<div class="container-fluid">
<span class="badge badge-secondary">Badge 1</span>
</div>
<div class="container-fluid">
<span class="badge badge-secondary" (click)="navigateToBadge2()">Badge 2</span>
</div>
<div class="container-fluid">
<span class="badge badge-secondary">Badge 3</span>
</div>
<div class="container-fluid">
<span class="badge badge-secondary">Badge 4</span>
</div>
</div>
<router-outlet>
</router-outlet>
Dashboard TS
navigateToBadge2() {
this.router.navigate(['/dashboard/badge2']);
}
Whenever I am clicking the badge, it's navigating properly but the badges are still being displayed. I wanted to navigate only to badge component without displaying the Dashboard screen. Below is the result. I have my header and footer fixed but, the badges are being displayed even if the navigation successful. If I remove the from Dashboard component. Unable to see the badge content. Could anyone help me with the scenario. Thanks in advance
routing module
{ path: 'dashboard', component: DashboardComponent, children:
[
{ path: 'badge1', component: Badge1Component },
{ path: 'badge2', component: Badge2Component },
{ path: 'badge3', component: Badge3Component }]}