[英]Nested Array Form (Angular2)
The only error you seem to have in your plunker, is the iteration of the surveys
array, instead of: 你似乎在你的plunker唯一的错误,是的迭代surveys
阵列,而不是:
*ngFor="let survey of myForm.controls.objects.controls; let j=index"
it should be: 它应该是:
*ngFor="let survey of object.controls.surveys.controls; let j=index"
where object
refers to the iterations of objects
form array in the higher level iteration. 其中object
指的是迭代objects
以在所述更高级别的迭代的数组。
So now when clicking Line End
button in the Survey
tab is working fine, see the forked Plunker 因此,现在在“ Survey
选项卡中单击“ Line End
按钮时,它可以正常工作,请参阅叉状柱塞
See Your code the error states that the surveys object is not binded while looping.You need to loop properly in HTML .Check the below code 请参阅您的代码,错误指出循环时未绑定测量对象。您需要在HTML中正确循环。检查以下代码
<div *ngFor="let item of formvalue.objects; let i=index">
<ul>
<li>{{item.date}}</li>
</ul>
<div *ngFor="let survey of item.surveys ; let j=index">
<ul>
<li>{{survey.br_0}} </li>
</ul>
</div>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.