0
我真的不明白是什麼在此代碼的問題:角度自定義輸入號碼不起作用
app.directive('counter', function() {
return {
restrict: 'A',
scope:{},
template:'<div class="item-counter"><input type="text" data-ng-model="qnt"><span class="glyphicon glyphicon-chevron-up" data-ng-click="increment()"><span class="glyphicon glyphicon-chevron-down" data-ng-click="decrement()"></span><button type="button" class="btn btn-success">Aggiungi</button></div>',
controller: function($scope) {
$scope.qnt = 1;
$scope.increment = function() {
$scope.qnt++;
};
$scope.decrement = function() {
console.log($scope.qnt > 1);
if ($scope.qnt > 1) {
$scope.qnt--;
}
console.log($scope.qnt);
};
},
link: function(scope, element, attrs) {
}
};
});
增量工程遞減不起作用。 有什麼問題?
http://plnkr.co/edit/BdFHpnrJnG4DFjTkmuZ0?p=preview
THX我傻:) – Whisher 2014-10-27 10:52:50
沒有後顧之憂!樂意效勞。 :-) – 2014-10-27 10:53:16