小编sau*_*h k的帖子

错误:无法匹配任何路由.网址细分: - Angular 2

我是angular2的新手.我试图了解如何<router-outlets>在特定模板中使用多个.我在这里经历了很多质量保证,但无法解决我的错误.

router.module.ts

const routes: Routes = [
{
    path: '',
    redirectTo: 'one',
    pathMatch: 'full'
},
{
    path: 'two',
    component: ClassTwo, children: [
        {
            path: 'three',
            component: ClassThree,
            outlet: 'nameThree',
        },
        {
            path: 'four',
            component: ClassFour,
            outlet: 'nameFour'
        }
    ]
},];
Run Code Online (Sandbox Code Playgroud)

component1.html

<h3>In One</h3>

<nav>
    <a routerLink="/two" class="dash-item">...Go to Two...</a>
    <a routerLink="/three" class="dash-item">... Go to THREE...</a>
    <a routerLink="/four" class="dash-item">...Go to FOUR...</a>
</nav>

<router-outlet></router-outlet>                   // Successfully loaded component2.html
<router-outlet name="nameThree" ></router-outlet> // Error: Cannot match any routes. URL Segment: 'three' …
Run Code Online (Sandbox Code Playgroud)

angular2-routing angular

22
推荐指数
2
解决办法
7万
查看次数

标签 统计

angular ×1

angular2-routing ×1