1
Angular2でシンプルなルーティングを作成しようとすると: CでAngular2 - エラールーティング - タイプ 'の文字列は' 'タイプ<any>' を入力する割り当てられない
ERROR:/プロジェクト/ゲーミフィケーション/ srcに/アプリ/アプリを。 routing.ts(8,7):以下のように
Type '({ path: string; redirectTo: string; pathMatch: string; } |
{ path: string; component: string; })[]'
is not assignable to type 'Route[]'.
Type '{ path: string; redirectTo: string; pathMatch: string; } |
{ path: string; component: string; }' is not assignable to type 'Route'.
Type '{ path: string; component: string; }' is not assignable to type 'Route'.
Types of property 'component' are incompatible.
Type 'string' is not assignable to type 'Type<any>'
app.routing.ts:
const routes: Routes = [
{ path: '', redirectTo:'/login', pathMatch: 'full' },
{ path: 'explorer', component:'ExplorerQuizComponent' },
{ path:'login', component: 'LoginComponent'}];
@NgModule({imports: [ RouterModule.forRoot(routes) ], exports: [ RouterModule ]})`
ありがとうございました、@Wang Steven。それは今働く。 –