Angular2 - 路由错误 - 类型 'string' 不可分配给类型 'Type<any>'

Angular2 - routing error - Type 'string' is not assignable to type 'Type<any>'

尝试在 Angular2 中创建一个简单的路由:

错误 C:/projects/gamefication/src/app/app.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 ]})`

删除 ' ,请尝试:

const routes: Routes = [
{ path: '', redirectTo:'/login', pathMatch: 'full' },
{ path: 'explorer', component:ExplorerQuizComponent },
{ path:'login', component: LoginComponent}];