Angular 2 component directive not working

后端 未结 2 1476
广开言路
广开言路 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: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

提交回复
热议问题