更新时间:2021-10-10 08:59:19
Ionic2 在构建到 android 时使用提前编译.AoT 要求:
Ionic2 uses ahead of time compile when building to android. AoT requires:
A) 要公开的属性
B) html 中提到的要在组件中声明的属性.
B) properties that are mentioned in the html to be declared in the component.
所以要解决您的问题,请声明公共用户名:字符串;在组件中并声明您在表单中访问的其他名称.
So to fix your problem declare public username:string; in the component and aswell declare other names you are accessing in your form.
或者...在 html 中你可以写 formControlName='user.username' 并使用你已经声明的属性.
Or ... in the html you can write formControlName='user.username' and use the property you already declared.
不要忘记在组件中声明你的 elementref
Don't forget to declare your elementref in the component aswell