Skip to content

Commit 2a054e9

Browse files
committed
Add routing to demo-app
1 parent 622ad23 commit 2a054e9

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

projects/demo-app/src/app/app.component.html

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<mat-sidenav-container class="container">
2-
<mat-sidenav #sidenav mode="side" [(opened)]="opened">
2+
<mat-sidenav #sidenav mode="side" [(opened)]="opened" style="width: 15%">
33
Sidenav content
44
</mat-sidenav>
55

@@ -12,7 +12,6 @@
1212
<h1>Ngx Mention</h1>
1313
</mat-toolbar-row>
1414
</mat-toolbar>
15-
<app-static></app-static>
16-
<app-async></app-async>
15+
<router-outlet></router-outlet>
1716
</mat-sidenav-content>
1817
</mat-sidenav-container>

projects/demo-app/src/app/app.module.ts

+18
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,29 @@ import { MatSidenavModule } from '@angular/material/sidenav';
77
import { MatToolbarModule } from '@angular/material/toolbar';
88
import { BrowserModule } from '@angular/platform-browser';
99
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
10+
import { RouterModule, Routes } from '@angular/router';
1011
import { NgxMentionModule } from 'projects/ngx-mention/src/lib/ngx-mention.module';
1112
import { environment } from '../environments/environment';
1213
import { AppComponent } from './app.component';
1314
import { AsyncComponent } from './async/async.component';
1415
import { StaticComponent } from './static/static.component';
1516

17+
const routes: Routes = [
18+
{
19+
path: '',
20+
redirectTo: 'static',
21+
pathMatch: 'full',
22+
},
23+
{
24+
path: 'static',
25+
component: StaticComponent,
26+
},
27+
{
28+
path: 'async',
29+
component: AsyncComponent,
30+
},
31+
];
32+
1633
@NgModule({
1734
declarations: [AppComponent, AsyncComponent, StaticComponent],
1835
imports: [
@@ -24,6 +41,7 @@ import { StaticComponent } from './static/static.component';
2441
MatToolbarModule,
2542
MatIconModule,
2643
MatButtonModule,
44+
RouterModule.forRoot(routes),
2745
],
2846
providers: [
2947
{

0 commit comments

Comments
 (0)