Ashish Panwar Ashish Panwar - 2 months ago 15
Node.js Question

Angular2: 'directives' property not found in @Component({.....})

I created a directive to auto-grow a textbox but when i implemented it to the component i'm getting the error.

myAppComps.ts

enter image description here

NPM RUN BUILD

enter image description here

auto-grow.directives.ts

enter image description here

myAppComps.html

enter image description here

package.json:

enter image description here

Answer

If you are using RC6 and up - you need to use @NgModule to declare the directives (under 'declarations'):

@NgModule({
  imports:      [ BrowserModule],
  declarations: [ AppComponent,PeopleListComponent ],  //<----here
  providers:    [],      
  bootstrap:    [ AppComponent ]
})

Source