Angular2 TypeScript指令错误TS2345
发布时间:2020-12-17 08:07:07 所属栏目:安全 来源:网络整理
导读:当我编译我的应用程序与tsc我得到这个错误TS2345: error TS2345: Argument of type '{ selector: string; template: string; directives: (typeof Title | any[])[]; providers: typeof Goo...' is not assignable to parameter of type 'ComponentMetadata
当我编译我的应用程序与tsc我得到这个错误TS2345:
error TS2345: Argument of type '{ selector: string; template: string; directives: (typeof Title | any[])[]; providers: typeof Goo...' is not assignable to parameter of type 'ComponentMetadataType'. 这里是我的代码: import { Component,Input } from "@angular/core"; import { Title } from "./components/title"; import { Timeline } from "./components/timeline"; @Component({ selector: "edu",template: ` <div id="Edu" class="Edu content section scrollspy"> <title [icon]="titleIcon" [title]="titleTitle"></title> <timeline [data]="edu"></timeline> </div> `,directives: [Title,Timeline] }) export class Edu { private titleIcon = "graduation-cap"; private titleTitle = "Education"; @Input("data") edu: Array<Object>; } 我的代码中没有看到任何错误,也是以前的工作。任何人都可以看到有什么问题吗? 注意:我使用Angular2-rc6和TypeScript 1.8.10,希望这些信息有所帮助
指令已被弃用并被删除。
时间和时间表现在应该放在你的@NgModule声明中: @NgModule({ declarations: [Time,Timeline,...],... }) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |