无法在Angular2中创建组件

时间:2017-06-27 16:41:09

标签: angular typescript

我是Angular2的新手,我尝试创建新的组件但是有错误

Argument of type '{ selecor: string; templateUrl: string; }' is not assignable 
to parametof type 'Component'.
Object literal may only specify known properties, and 'selecor' does not  
exist in type 'Component'.enter code here.

这是组件的代码。

Import { Component } from '@angular/core';
@Component({
   selecor: 'app-server',
   templateUrl: './server.component.html'
})
export class ServerComponent {}

这是app.module.ts中的代码段

import { ServerComponent } from './server/server.component';
@NgModule({
declarations: [
  AppComponent,
  ServerComponent
],

1 个答案:

答案 0 :(得分:2)

应该 selector 而不是 selecor

@Component({
   selector : 'app-server',
   templateUrl: './server.component.html'
})