0
I configured the routes, but the component does not render when the application is initialized. I need the component posts
render inside the component blog
, and the blog already loads correctly.
app.component.html:
<app-navbar></app-navbar>
<!-- corpo da página -->
<router-outlet></router-outlet>
app.routing.module.ts:
const appRoutes: Routes = [
{ path: '', component: BlogComponent},
{ path: 'blog', component: BlogComponent},
{ path: 'candidatos', component: CandidatosComponent},
{ path: 'sobre', component: AboutComponent},
];
blog.component.html:
<div id="conteudo" class="container-fluid">
<div class="row">
<div class="col-10">
hello, world!
<router-outlet></router-outlet>
</div>
<!-- direita -->
<div class="col-md-2">
<app-aside></app-aside>
</div>
</div>
</div>
blog.routing.module.ts:
const blogRoutes: Routes = [
{ path: 'blog', component: BlogComponent, children: [
{ path: '', component: PostsComponent },
{ path: 'posts', component: PostsComponent },
{ path: 'news', component: NewsComponent },
{ path: 'estudos', component: EstudosComponent }
]
}
];
blog/posts also does not work?
– Eduardo Vargas
@Eduardovargas the blog component loads as home page of the app... It loads normally but does not bring together the child component posts. The idea is that everything comes together when the app is loaded.
– João Marcos Duarte
I think I know what the problem is. Try /blog/blog/posts
– Eduardo Vargas