Running the application usingng serve
works fine.
usingng build
works fine.
when usingng build --prod --aot
orng 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"
即可!