我想要一个 Enter-comp。作为概述,基本上是两个孩子。例如登录和注册组合。此外,我想用多个路由器插座来管理它。但是“当然”它还不起作用。它让我一直在扔:Error: Cannot match any routes. URL Segment: ',%20%7Boutlets:%20%7Blogin:%20%5B'login'%5D%7D%7D'
应用路由配置
const routes: Routes = [
{path: 'stories', component: StoriesComponent},
{path: '', component: EnterOverviewComponent, children: [
{path: 'login', component: LoginComponent, outlet: 'login'},
{path: 'register', component: RegisterComponent, outlet: 'register'},
]}
];
应用程序根
<app-navbar></app-navbar>
<router-outlet></router-outlet>
<router-outlet name="login"></router-outlet>
<router-outlet name="register"></router-outlet>
导航栏比较
期待这里的错误。我怀疑,我称之为错误路线:
<ul class="navbar-nav ml-auto">
<li class="nav-item" routerLinkActive="active">
<a class="nav-link" routerLink="/, {outlets: {login: ['login']}}">Sign In</a>
</li>
<li class="nav-item" routerLinkActive="active">
<a class="nav-link" routerLink="/, {outlets: {register: ['register']}}">Register</a>
</li>
</ul>