0
我想实现一个角度2到我的项目中的用户认证包:http://jasonwatmore.com/post/2016/09/29/angular-2-user-registration-and-login-example-tutorial。角2路由器:孩子没有siplayed
我把整个文件夹放入名为“loginMGR”的超级文件夹,在模块,组件和文件名中将“app”改名为“loginMGR”,并将app-routing.module(现名为loginMGR.module)更改为:
imports...
const loginRoutes: Routes = [
{
path: '',
component: HomeComponent,
canActivate: [AuthGuard],
children: [
{ path: 'identification', component: LoginComponent },
{ path: 'enregistrement', component: RegisterComponent },
]
},
// otherwise redirect to home
{ path: '**', redirectTo: '' }
];
@NgModule({
imports: [
RouterModule.forChild(loginRoutes)
],
exports: [
RouterModule
]
})
export class LoginRoutingModule
我的应用程序路由采用下列路线模块名称的链接:
const routes: Routes = [
...
{ path: 'authentification', component: LoginMGRComponent },
...
我访问束感谢这个按钮:
<a [routerLink]="['/authentification']" [routerLinkActive]="['router-link-active']" [routerLinkActiveOptions]="{exact:true}" class="navbar-link">
但是,router-outlet和我的loginMGR.component.html的警报保持为空,并且不链接到它们应该访问的不同组件(在这种情况下,“'将会是”home“)。
任何想法我做错了什么?
谢谢
就是这样!谢谢。而且,我没有提到整个文件,我应该这样做。我的AppRoutingModule导入在阻止声明的LoginRoutingModule之前。 – Callehabana