2017-09-13 52 views
1

請參閱plunker here演示問題:AngularJS - 獲取從行的第一列中的值在一個表上更改事件

我想對於任何給定的行顯示對應的英文值(第一列)當任何值被改變時。因此,例如,當第二行中的任何值發生更改時,應始終在彈出窗口中顯示「已上載」。

我已經例如迄今爲止獲得這樣的,但也不能令人信服:

<textarea ng-model="res.Value" 
      ng-change="vm.changed(vm.resourceGridResources.Resources[$index].Resources[0].Value)" 
      style="min-width: 300px"></textarea> 

回答

2

爲了您爲例。 請勿使用$index,而應使用$parent.$index。 它將引用前ng-repeat$index

<textarea ng-model="res.Value" 
      ng-change="vm.changed(vm.resourceGridResources.Resources[$parent.$index].Resources[0].Value)" 
      style="min-width: 300px"> 
</textarea> 

Corrected plunkr

+0

非常感謝.... –

相關問題