18

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'.

1 Answer 1

35

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 { }
4
  • @ESturzenegger Have you removed directives from your component? Oct 6, 2016 at 8:55
  • 1
    sry for deleting my question: "Even after adding it to declarations, it shows me the same error" @StefanSvrkota yes i did. The funny thing is: the pipe works but the error shows in my cli. Oct 6, 2016 at 8:56
  • @ESturzenegger Well I don't know really, try restarting/refreshing your project. It's really weird. Oct 6, 2016 at 9:03
  • @StefanSvrkota according to the docs is the pipe property not existent: angular.io/docs/ts/latest/api/core/index/… Oct 6, 2016 at 9:14

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.