gpt4 book ai didi

Angular 2.0 版本 : Pipes and Directives are not properties of @Component anymore

转载 作者:太空狗 更新时间:2023-10-29 16:56:06 27 4
gpt4 key购买 nike

我刚刚将我在 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 起,所有指令和管道都应移至模块的声明

@NgModule({
imports: [...],
declarations: [
//you insert your Components, Directives and Pipes here
],
bootstrap: [...],
providers: [...]
})

export class AppModule { }

关于 Angular 2.0 版本 : Pipes and Directives are not properties of @Component anymore,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39539085/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com