Angular 2.0 版:管道和指令不再是@Component 的属性
Angular 2.0 Release: Pipes and Directives are not properties of @Component anymore
我刚刚将我在 RC5 上构建的应用程序升级到最终版本,我对现在应该声明指令和管道的方式感到困惑。我收到此错误:
ERROR in [default] C:\xampp\htdocs\meriem-car\public\src\app\components\administration.component.ts:12:4
Argument of type '{ moduleId: string; selector: string; directives: typeof LoginComponent[]; templateUrl: string; }' is not assignable to parameter of type 'Component'.
Object literal may only specify known properties, and 'directives' does not exist in type 'Component'.
自 RC6 起,所有指令和管道都应移至模块的 declarations
。
@NgModule({
imports: [...],
declarations: [
//you insert your Components, Directives and Pipes here
],
bootstrap: [...],
providers: [...]
})
export class AppModule { }
我刚刚将我在 RC5 上构建的应用程序升级到最终版本,我对现在应该声明指令和管道的方式感到困惑。我收到此错误:
ERROR in [default] C:\xampp\htdocs\meriem-car\public\src\app\components\administration.component.ts:12:4 Argument of type '{ moduleId: string; selector: string; directives: typeof LoginComponent[]; templateUrl: string; }' is not assignable to parameter of type 'Component'. Object literal may only specify known properties, and 'directives' does not exist in type 'Component'.
自 RC6 起,所有指令和管道都应移至模块的 declarations
。
@NgModule({
imports: [...],
declarations: [
//you insert your Components, Directives and Pipes here
],
bootstrap: [...],
providers: [...]
})
export class AppModule { }