javascript - Angular 2 - Error on attribute directive syntax..has i missed anything? -
this question has answer here:
my error:
error in c:/smartphonesalesapp/src/app/test.directive.ts (9,3): declaration expe cted. error in c:/smartphonesalesapp/src/app/dashboard/dashboard.component.ts (7,3): rgument of type '{ selector: string; templateurl: string; directives: typeof tes tdirective[]; }' not assignable parameter of type 'component'. object literal may specify known properties, , 'directives' not ex ist in type 'component'.
my component code :
import { component } '@angular/core'; import { testdirective } '../test.directive'; @component({ selector: 'dashboard', templateurl: './dashboard.component.html', directives: [testdirective] }) export class dashboardcomponent { title = 'welcome dashboard'; }
i dono why i'm getting error. need import angular core module related directive..??
there 2 problems code:
- directives property no longer supported in
@component
decorator need register directive in@ngmodule
- you have semicolon here:
@directive({se... 'onmouseleave()'}}); <----
Comments
Post a Comment