Tracker
Tracker

Reputation: 435

How to declare directives in angular 2

When i tried using directives,it says error

Argument of type '{ selector: string; templateUrl: string; providers: typeof HeaderClass[]; directives: typeof Moda...' is not assignable to parameter of type 'Component'.

Object literal may only specify known properties, and 'directives' does not exist in type 'Component'.

Here is my code,

@Component({
  selector: 'my-app',
  templateUrl: './app/common/common.component.html',
  providers: [HeaderClass],
  directives: [ModalComponent]
})

Can anyone please help me.Thanks.

Upvotes: 1

Views: 2076

Answers (1)

Milad
Milad

Reputation: 28590

In the older version Angular2 , like beta , that was how you would define a directive.

But after rc, you don't do that anymore and you declare that directive in the modules.

@NgModule({

   declarations:[ModalComponent]

})

Upvotes: 1

Related Questions