routing - Angular router always redirecting to the same module -


this driving me crazy. have 3 simple routes in app module:

routes: routes = [     { path: '', redirectto: '/customers', pathmatch: 'full' },     { path: 'customers', loadchildren: './components/customer#customermodule' },     { path: 'promotions', loadchildren: './components/promotion#promotionmodule'} ]; 

in customer module have defined theses routes:

routes: routes = [     {         path: '', component: customercomponent, children: [             { path: '', component: customersearchcomponent },             { path: ':id', component: customerdetailcomponent }     ]} ]; 

and in promotion modules:

routes: routes = [     { path: '', component: promotioncomponent },     { path: 'new', component: promotionnewcomponent } ]; 

i have <router-outlet></router-outlet> in appcomponent , customercomponent. thing is, when going route /promotions, still getting redirected customermodule -> customercomponent -> customersearch

why happening? can't figure out

edit: navigation have header component contains:

<ul class="nav navbar-nav">             <li>                 <a [routerlink]="['./customers']"                    routerlinkactive="active" [routerlinkactiveoptions]="{exact: true}">                     customers                 </a>             </li>             <li>                 <a [routerlink]="['./promotions']"                    routerlinkactive="active" [routerlinkactiveoptions]="{exact: true}">                     promotions                 </a>             </li>         </ul> 

the app component this:

<app-header></app-header>  <main class="container">   <router-outlet></router-outlet> </main> 

i think need specify full routes, in feature module routing.

whats happening it's going customer routing , finding path '' + '' , landing on customersearchcomponent.

try changing base path customer routing 'customer' instead of '' , changing paths in promotion routing 'promotion' , 'promotion/new'


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -