Iユーザーがゲストの場合は、次の式を持っている:私のapp.component.tsで角度2 RC5のrouter.navigate動作しない
this.router.navigate(['/intro']);
ngOnInit()
方法。
私app.component.htmlは<router-outlet></router-outlet>
を持っていますが、私はゲストとして私のアプリにアクセスした場合、IntroComponent
が表示されず、URLは/intro
ない空のままです。
どういうところが間違っていますか?
私app.routes.ts
const appRoutes: Routes = [
{ path: '', component: HomeComponent },
{path:'intro',component: IntroComponent},
{path:'login',component: LoginComponent},
{path:'register', component: RegisterComponent}
];
どのバージョンのAngularを使用していますか?ルートが設定されていますか?あなたはあなたのバージョンを適切にインポートしていますか? –
ルートが設定されています、RC.5。 app.routes.tsを追加しましたHomeCOmponentが読み込まれましたthis.routerでイントロにナビゲートしていますが – TheUnreal
最小の例をプランナーに貼り付けてください。 – mxii