Angular2辅助路线不起作用

时间:2016-07-28 21:50:27

标签: angularjs angular angular2-routing

我试图在我的角度2应用程序中使用辅助路线,但不知何时找不到辅助路线。
home.page.component.ts 已加载到我的主插座中,该插座工作正常。

我修改了下面的代码以简化其可读性

  

home.page.component.ts

<ul class="nav nav-tabs">
    <li class="active"><a href="#">Home</a></li>
    <li><a [routerLink]="['/','childRouter:wepays']">WePays</a></li>
</ul>

<router-outlet name="childRouter"></router-outlet>
  

routes.ts

import { provideRouter, RouterConfig, RouterOutlet }  from '@angular/router';
import { LoginComponent } from '../components/login.component';
import { HomeComponent } from '../components/home.component';
import { WePaysComponent } from '../components/wepays.component';

const routes: RouterConfig = [
    {
        path: '',
        redirectTo: '/login',
        pathMatch: 'full',
    },
    {
        path: 'login',
        component: LoginComponent,
    },
    {
        path: 'home',
        component: HomeComponent,
    },
    {

        path: 'wepays',
        component: WePaysComponent,
        outlet: 'childRouter'   
    }
];

export const APP_ROUTER_PROVIDERS = [
    provideRouter(routes)
];
  

点击时: [routerLink] =&#34; [&#39; /&#39;,&#39; childRouter:wepays&#39;]&#34;

Error: Uncaught (in promise): Error: Cannot find the outlet childRouter to load 'WePaysComponent'

0 个答案:

没有答案