1
Iam嘗試獲取切換值,但在第一次未檢查切換按鈕點擊後,它不工作。當選擇切換按鈕以取消選擇時,離子ng-change在第一時間沒有被觸發
<ul class="list has-header">
<li class="item item-toggle" ng-repeat="ingr in ingredients|filter:searching">
{{ingr.INGREDIENTNAME}}
<label class="toggle toggle-energized" >
<input type="checkbox" ng-model="ingr.INGREDIENTSTATUS" ng-change='changeingrStatus(ingr.INGREDIENTCODE,ingr.INGREDIENTSTATUS)' ng-checked="{{ingr.INGREDIENTSTATUS==1?true:false}}">
<div class="track">
<div class="handle"></div>
</div>
</label>
</li>
</ul>
Controller.js
$scope.changeingrStatus = function(code, status) {
console.log(status);
}
您可以嘗試使用$ scope。$ watch捕獲更新複選框 – Pterrat