0
在中繼器中,我在每行中顯示一些包含一些數據,輸入字段和span標籤的記錄。當用戶在輸入字段中輸入數值時,我想對其進行計算並在span
標記中顯示結果。這將使用ng-keyup
使用ng-keyup更新ng-repeat中的範圍
我已經試過,但它不工作,可能becuse我沒有正確使用模型...
<div ng-repeat="bet in $ctrl.bets">
<input class="form-control input-sm" ng-model="$index" type="text" ng-keyup="$ctrl.getReturn($index)">
<span>Return: </span><span id="$index" ng-model="$index"></span>
</div>
而且在我的控制器我有這個
按鍵時發生vm.getReturn = function(index){
document.querySelector('#' + index).html(value/2);
}
我知道它的方式,但有人可以告訴我如何做到這一點?助教。
圖例。謝謝。 –
@Josethehose很高興幫助你,謝謝;) –