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:

  1. directives property no longer supported in @component decorator need register directive in @ngmodule
  2. you have semicolon here:

@directive({se... 'onmouseleave()'}}); <----


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -