I am working in a Angular Project and i need add a breadcrumb, but i have a problem...
My components work with nested 'redirectTo', for example:
//app-routing.module.ts
//Here: Home
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
@NgModule({
imports: [
RouterModule.forRoot([
{
path: "",
pathMatch: "full",
redirectTo: "/pass/login"
},
{
path: "pass",
pathMatch: "full",
redirectTo: "/pass/login"
}
])
],
exports: [RouterModule]
})
export class AppRoutingModule {}
//home-routing.module.ts
//Here: Home > Credit Simulation
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import {HomeComponent} from './home/home.component';
@NgModule({
imports: [
RouterModule.forChild([
{
component: HomeComponent,
path: 'pass/home',
data: {
breadcrumb: 'Credit Simulation' //I tried
}
}
])
],
exports: [RouterModule]
})
export class HomeRoutingModule {
}
//request-routing.module.ts
//Here: Home > Credit Simulation > Preq
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import {PreqComponent} from './preq/preq.component';
import {RequestComponent} from './request/request.component';
@NgModule({
imports: [
RouterModule.forChild([
{
component: PreqComponent,
path: 'pass/preq'
},
{
component: RequestComponent,
path: 'pass/request'
}
])
],
exports: [RouterModule]
})
export class RequestRoutingModule {
}
I tried with a lot of solutions in communities and all work with childrens and routes in app.routing.ts
I have a clue: Maybe with a object through the components, but how?
Please suggest me a solution for this problem
Aucun commentaire:
Enregistrer un commentaire