decreament值我有這樣的代碼:NG-變化增量和NG-repeat循環
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Welcome to LearnKode - A code learning platform</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script>
</head>
<body ng-app="changeExample">
<div ng-controller="ExampleController">
<div class="container">
<div class="col-md-3 well">
Are you developer <input type="checkbox" ng-model="isTrue" ng-change="count=count+1" />
Count: {{count}}
<pre>{{isTrue}}</pre>
</div>
</div>
</div>
<script>
var app = angular.module("changeExample", []);
app.controller('ExampleController', ['$scope', function ($scope) {
$scope.isTrue = true;
}]);
</script>
</body>
</html>
在這段代碼時選中的複選框的數量會增加。這裏如何檢查複選框是否勾選,然後只增加,否則如果不勾選,它會減少。請任何人幫忙。
嘗試'NG-變化= 「IsTrue運算(計數=計數+ 1):(數=計-1)' –
那麼什麼是你的這個要求呢?」 我有多個ng-repeat循環中的複選框「 – Nitheesh