각도 2의 사용자 인증 번들을 내 프로젝트에 구현하려고합니다 : http://jasonwatmore.com/post/2016/09/29/angular-2-user-registration-and-login-example-tutorial.각도 2 라우터 : 자식이 실행되지 않음
전체 폴더를 "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
내 애플 라우팅 다음과 같은 경로로 모듈 이름을 링크 :
<a [routerLink]="['/authentification']" [routerLinkActive]="['router-link-active']" [routerLinkActiveOptions]="{exact:true}" class="navbar-link">
,369 :
const routes: Routes = [
...
{ path: 'authentification', component: LoginMGRComponent },
...
내가이 버튼에 번들 덕분에 액세스
그러나 라우터 출력과 내 loginMGR.component.html의 경고는 비어 있으며 액세스 할 수있는 다른 구성 요소 (이 경우 ''는 "집"임)로 연결되지 않습니다.
내가 뭘 잘못하고 있는지 알기!
는 당신이 LoginRoutingModule에 자녀 경로를 정의하기 때문에
그게 전부 야! 고맙습니다. 게다가, 나는 전체 파일을 언급하지 않았다, 나는 그것을 했어야했다. 내 AppRoutingModule 가져 오기는 선언을 차단 한 LoginRoutingModule 앞에있었습니다. – Callehabana