700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > Angular: Property 'controls' does not exist on type 'AbstractControl'. ng build --prod  error

Angular: Property 'controls' does not exist on type 'AbstractControl'. ng build --prod  error

时间:2022-02-19 07:31:40

相关推荐

Angular:  Property 'controls' does not exist on type 'AbstractControl'.  ng build --prod  error

Running the application usingng serveworks fine.

usingng buildworks fine.

when usingng build --prod --aotorng build --prodI 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"

即可!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。