模板错误类型“AbstractControl"不可分配给类型“FormControl" [英] Template error Type 'AbstractControl' is not assignable to type 'FormControl'
本文介绍了模板错误类型“AbstractControl"不可分配给类型“FormControl"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么我会收到此错误?
Why am I getting this error?
以下代码适用于另一个应用程序
The following code works in another application
<input class="form-control form-control-sm" type="number" min="0"
[formControl]='invoiceForm.get("quantity")'>
在这个新应用程序中它也可以工作,但仍然在终端中抱怨
in this new application it works too but still complaining in the terminal
Type 'AbstractControl' is not assignable to type 'FormControl'.
推荐答案
<input type="password" placeholder="Confirm Password" class="form-control" [formControl]="$any(myForm).controls['confirmpassword']"/>
使用 $any 函数禁用类型检查.我用这个解决了我的错误.
Use the $any function to disable type checking. I resolved my error by using this.
这篇关于模板错误类型“AbstractControl"不可分配给类型“FormControl"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文