web-dave / angular-starter-v2

6 stars 3 forks source link

Child Routing #6

Open web-dave opened 7 years ago

web-dave commented 7 years ago
web-dave commented 7 years ago

generate

ng g c books/book-list

web-dave commented 7 years ago

app-routing.module.ts

const routes: Routes = [
  {
    path: 'books',
    component: BooksComponent,
    children: [{
      path: '',
      component: BookListComponent
    }]
  },
  ...
];
web-dave commented 7 years ago

books.component.html

  <p>
    book works!
  </p>
  <router-outlet></router-outlet>