TypeScript-'s Angular Framework Error - “There is no directive with exportAs set to ngForm”

前端 未结 22 1694
轻奢々
轻奢々 2020-12-04 09:18

I keep getting this error while using TypeScript\'s Angular2-forms framework:

There is no directive with \"exportAs\" set to \"ngForm

22条回答
  •  天命终不由人
    2020-12-04 09:33

    I've come to this same question over & over again, also due to same reason. So let me answer this by saying what wrong I was doing. Might be helpful for someone.

    I was creating component via angular-cli by command

    ng g c components/something/something

    What it did, was created the component as I wanted.

    Also, While creating the component, it added the component in the App Module's declarations array.

    If this is the case, please remove it. And Voila! It might work.

提交回复
热议问题