Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138163

named router outlet doesn't render template

$
0
0

I have a problem with my angular 8 app, not rendering into a named router-outlet.

The routes are:

routes.module:

const routes: Routes = [
    ...
    {
        path: 'settings', loadChildren: './settings/settings.module#SettingsModule', canActivate
    },
]

settings.module

RouterModule.forChild([
  {
    path: '', component: SettingsComponent
  },
  {
    path: 'profile', component: ProfileComponent, outlet: 'settings_o'
  },
  {
    path: 'users', component: UsersComponent, outlet: 'settings_o'
  }
])

settings.component.html

<nav mat-tab-nav-bar color="primary" class="bg-whitesmoke primary">
<span mat-tab-link
   *ngFor="let link of navLinks"
   [routerLink]="[{outlets: {settings_o: [link.link]}}]"
   routerLinkActive #rla="routerLinkActive"
   [active]="rla.isActive">
  {{link.label}}
</span>
</nav>
<router-outlet name="settings_o"></router-outlet>

When I click a link, the url in the address bar changes (e.g. to http://localhost:4200/settings/(settings_o:profile)), but no content is rendered to settings_o, nor do the components get loaded. There is no error in the console.

link.link is, for example simply profile like in settings.module's routes.

What do I need to change?


Viewing all articles
Browse latest Browse all 138163

Trending Articles