2
我是Aurelia Js的新手,我使用repeat.for列出了一些可能包含一些值的文本框。在這裏,列出的文本框是好的,問題是我正在使用value.bind綁定以前的值/新值(用戶輸入),而在文本框中鍵入,它申請所有模型(所有i.companyname)Aurelia repeat.for雙向綁定
代碼:
<div class="row" repeat.for="i of experience_array">
<input type='text' value.bind='i.companyname'/>
<input type='text' value.bind='i.experience'/>
</div>
也試過:
<div class="row" repeat.for="i of experience_array.length">
<input type='text' value.bind='$parent.experience_array[i]['companyname']'/>
<input type='text' value.bind='$parent.experience_array[i]['experience']'/>
</div>
如何解決這一問題?猜猜,我錯過了aurelia綁定概念中的一些東西。
不能重現此:https://gist.run/?id=196d22b7eef6d461b19924ef6fd4cc07 –
嗨@MatthewJamesDavis,這是我確切的情況。更新了GitRun https://gist.run/?id=a11f8500803a7b6053f980b7aaa48165 – sibi
,同時點擊添加按鈕,將新的obj推向數組。這裏模型更新相同的值。謝謝你,並且非常需要。 – sibi