Tôi là người mới bắt đầu trong Angular 2 và tôi đang sử dụng phiên bản phát hành Angular 2 cuối cùng. Tôi có một vấn đề lạ với nó. đây là databinding.component.ts tôi mã:Lỗi góc 2 ('chỉ thị' không tồn tại trong loại 'Hợp phần')
import { Component } from '@angular/core';
import {PropertyBindingComponent} from './property-binding.component';
import {EventBindingComponent} from './event-binding.component';
@Component({
selector: 'fa-databinding',
templateUrl: 'databinding.component.html',
styleUrls: ['databinding.component.css'],
directives: [PropertyBindingComponent, EventBindingComponent]
})
và đây là một sự yên app.module.ts tôi mã:
import { PropertyBindingComponent } from './databinding/property-binding.component';
import { EventBindingComponent } from './databinding/event-binding.component';
@NgModule({
declarations: [
AppComponent,
OtherComponent,
AnotherComponent,
DatabindingComponent,
PropertyBindingComponent,
EventBindingComponent
]
Mã này không hoạt động chính xác:
ERROR in [default] /home/tornado/work/first-app/src/app/databinding/databinding.component.ts:11:2
Argument of type '{ selector: string; template: any; styles: any[]; directives: (typeof PropertyBindingComponent | ...' is not assignable to parameter of type 'Component'.
Object literal may only specify known properties, and 'directives' does not exist in type 'Component'.
Tôi nên làm gì?!?!
Bản sao có thể có của chỉ thị [Angular2 phiên bản RC.6 "bên trong @Component Error] (http://stackoverflow.com/questions/39410591/angular2-version-rc-6-directives-inside-component-error) – Fiddles