Angularjs   发布时间:2022-04-20  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了将ReactiveFormsModule添加到我的angular 4应用程序后,没有获得NgControl错误的提供程序大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我收到此错误 – “模板解析错误:NgControl没有提供者”

The error comes from this line of code

 --> <SELEct (ngModel)="currencies" (ngModelChangE)="showPurchase($event)" class="Annka-center" name="curencies">
       <option *ngFor="let money of currencies; let i = index" (ngvalue)="money" (click)="showPurchase(money)"> {{money.Currency}} </option>
 </SELEct>

上面的代码工作顺利,直到我将ReactiveFormsModule添加到我的应用程序.

在这里尝试了解决方

ERROR in : No provider for NgControl Angular AOT

但这对我没有用.我正在使用Angular 4.

解决方法

应该

<SELEct [(ngModel)]="currencies" (ngModelChangE)="showPurchase($event)" class="Annka-center" name="curencies">
       <option *ngFor="let money of currencies; let i = index" (ngvalue)="money" (click)="showPurchase(money)"> {{money.Currency}} </option>
 </SELEct>

还要确保在导入下的app.module.ts中导入FormsModule
从’@ angular / forms’导入{FormsModule,ReactiveFormsModulE};

@NgModule({
    imports: [
         FormsModule      
    ]

大佬总结

以上是大佬教程为你收集整理的将ReactiveFormsModule添加到我的angular 4应用程序后,没有获得NgControl错误的提供程序全部内容,希望文章能够帮你解决将ReactiveFormsModule添加到我的angular 4应用程序后,没有获得NgControl错误的提供程序所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。