我已经使用Android制作了天气API网络应用程序,
链接:-https: //stackblitz.com/edit/maximlweatherapp
APP网址:-https: //maximlweatherapp.stackblitz.io
我在Visual Studio代码中使用了相同的代码,并且工作正常,没有给出任何错误,但是在StackBlitz中,却出现了错误。两者的唯一区别是在Visual Studio中,已安装Angular Version 8,但是我在这里使用Angular版本9,请任何人都能看到代码有什么问题并建议我进行一些更改,
在Angular 9中默认的AOT模式下,模板编译器比JIT模式下严格。
例如,在以下代码中:
[formGroup]="checkcity.at(itemindex)"
checkcity.at
方法返回,AbstractControl
并且与所需的类型不匹配FormGroupDirective
。
您可以自己铸造:
html
[formGroup]="getFormGroupAt(itemindex)"
ts
getFormGroupAt(i: number) {
return this.checkcity.at(i) as FormGroup;
}
或在您使用的每个位置使用内置的$ any()函数checkcity.at(itemindex)
$any(checkcity.at(itemindex))
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句