1. Register Routes
In app.module.ts
const appRoutes: Routes = [
{ path: '', component: HomeComponent },
{ path: 'users', component: UsersComponent },
{ path: 'servers', component: ServersComponent }
];
@NgModule({
imports: [
RouterModule.forRoot(appRoutes)
]
})
2. Display Routes
In XXX.html
<div class="row">
<div class="col-xs-12 col-sm-10 col-md-8 col-sm-offset-1 col-md-offset-2">
<router-outlet></router-outlet>
</div>
</div>
router-outlet is directive.
Html: What is in the page.
CSS: How to show the page.
JavaScript: Functions in page.
'IT' 카테고리의 다른 글
[angluar] routerLink with path (0) | 2018.03.19 |
---|---|
[angular] href VS routerlink (0) | 2018.03.18 |
[WEB] `와 '의 차이 (0) | 2018.03.16 |
[Angular] How to add bootStrap in Angular App (0) | 2018.02.18 |
[Angular] angular, databinding (0) | 2018.02.18 |