web-dave/angular-starter-v2

Child Routing

Opened this issue · 3 comments

  • Generate a BookListComponent into your Books Module
  • Set /books as a root of ChildRouting
  • Don't forget to add a router-outlet to books Component
  • Check the DevTools and the hints!

generate

ng g c books/book-list

app-routing.module.ts

const routes: Routes = [
  {
    path: 'books',
    component: BooksComponent,
    children: [{
      path: '',
      component: BookListComponent
    }]
  },
  ...
];

books.component.html

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