I have implemented a angular web application with material.
This web application has Side Navi and Routing
Codes ware as follows:
app.component.ts
<mat-sidenav-container class="mat-sidenav-container" autosize>
<mat-sidenav mode="side" class="mat-sidenav" opened>
<app-side-nav></app-side-nav>
</mat-sidenav>
<mat-sidenav-content>
<div class="app-header">
<app-header></app-header>
</div>
<div class="mat-sidenav-content">
<main class="content">
<app-breadcrumb></app-breadcrumb>
<router-outlet></router-outlet>
</main>
</div>
</mat-sidenav-content>
</mat-sidenav-container>
app-routing.module.ts
const routes: Routes = [
{
path: '',
component: LandingPageComponent
},
{
path: 'home',
data: { bc: "NAVI.HOME" },
children: [
{
path: '',
component: HomeComponent,
data: { bc: "" }
}
]
},
{
path: 'overview',
component: OverviewComponent,
data: { bc: "NAVI.OVERVIEW" }
},
.....
I have tried:
<app-landing-page></app-landing-page>
<mat-sidenav-container class="mat-sidenav-container" autosize>
<mat-sidenav mode="side" class="mat-sidenav" opened>
<app-side-nav></app-side-nav>
</mat-sidenav>
<mat-sidenav-content>
<div class="app-header">
<app-header></app-header>
</div>
<div class="mat-sidenav-content">
<main class="content">
<app-breadcrumb></app-breadcrumb>
<router-outlet></router-outlet>
</main>
</div>
</mat-sidenav-content>
</mat-sidenav-container>
in landing page I added a button, if it is clicked, web app should be leaded to home with side navi and contents.
<p>
landing-page works!
<button (click)="navitohome()"></button>
</p>
in the landing-page.ts
navitohome() {
this.router.navigate(['home']);
}
but this funcktion was not working
I have added the component landing page into app.component.html, but it was not working.
now I create a lading page component as usual, in this landing page exites a button odr , which leads to this web application (with side navi and the rest contents).
But I don't know, how should I change my code (app.component.ts or app-routing.module.ts)?
any solutions?
Best regards,
Leo