Angular2 Error: There is no directive with “exportAs” set to “ngForm”

后端 未结 11 2439
小鲜肉
小鲜肉 2020-12-01 13:33

i\'m on the RC4 and i\'m getting the error There is no directive with \"exportAs\" set to \"ngForm\" because of my template :

11条回答
  •  忘掉有多难
    2020-12-01 14:09

    Check that you have both ngModel and name attributes in your select. Also Select is a form component and not the entire form so more logical declaration of local reference will be:-

    One more Important thing is make sure you import either FormsModule in the case of template driven approach or ReactiveFormsModule in the case of Reactive approach. Or you can import both which is also totally fine.

提交回复
热议问题