Motassem Kassab
Motassem Kassab

Reputation: 1815

Angular 2.0 Release: Pipes and Directives are not properties of @Component anymore

I just upgraded my app which I built on RC5 to the final release, and I'm confused of the way I should be declaring Directives and Pipes now. I'm getting this error:

ERROR in [default] C:\xampp\htdocs\meriem-car\public\src\app\components\administration.component.ts:12:4 Argument of type '{ moduleId: string; selector: string; directives: typeof LoginComponent[]; templateUrl: string; }' is not assignable to parameter of type 'Component'. Object literal may only specify known properties, and 'directives' does not exist in type 'Component'.

Upvotes: 18

Views: 13487

Answers (1)

Stefan Svrkota
Stefan Svrkota

Reputation: 50663

Since RC6, all Directives and Pipes should be moved to module's declarations.

@NgModule({
    imports: [...],
    declarations: [
        //you insert your Components, Directives and Pipes here
    ],
    bootstrap: [...],
    providers: [...]
})

export class AppModule { }

Upvotes: 35

Related Questions