Angular 2 component directive not working

后端 未结 2 1477
广开言路
广开言路 2021-01-01 10:36

I am a beginner in angular 2 and I want to make my first app working. I am using TypeScript. I have the app.component.ts in which I have made a directive to

相关标签:
2条回答
  • 2021-01-01 11:02

    module.id was added in intially when angular2 was at beta version.Since with new version and angular cli support it is not required to add moduleId:module.id,you can remove from .ts files

    0 讨论(0)
  • 2021-01-01 11:15

    In your app.component.ts you define directive: [TodosComponent]. The directive property has been removed in RC6 from the @Component() decorator.

    The solution to this, is to:

    1. create an NgModule and
    2. declare the TodosComponent inside the declarations: [] array.

    See here for an example of AppModule:

    https://angular.io/docs/ts/latest/tutorial/toh-pt3.html

    0 讨论(0)
提交回复
热议问题