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

前端 未结 22 1676
轻奢々
轻奢々 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:32

    In case a name is assigned like this:

    #editForm="testForm"
    

    ... the exportAs has to be defined in the component decorator:

    selector: 'test-form',
    templateUrl: './test-form.component.html',
    styleUrls: ['./test-form.component.scss'],
    exportAs: 'testForm'
    

提交回复
热议问题