Running the application using ng serve
works fine.
using ng build
works fine.
when using ng build --prod --aot
or ng build --prod
I get the error.
出错位置:
<div *ngFor="let address of myForm.get('addresses').controls; let i=index"
解决方法:
一种方法:
在ts文件中添加方法:
formData {
return <FormArray>this.form.get('Data');
}
在html中:
<div *ngFor="let address of formData; let i=index"
<FormArray>中包括control
第二种方法:
直接改变html:
<div *ngFor="let address of myForm.get('addresses')['controls']; let i=index"
即可!