我是 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
],
最佳答案
应该是selector
而不是selecor
,
@Component({
selector : 'app-server',
templateUrl: './server.component.html'
})
关于angular - 无法在 Angular2 中创建组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44785655/