0
以下是ng-click的代碼,我只想點擊一次事件,然後禁用按鈕。但是,如何將ng-disabled僅用於按鈕標籤(不使用輸入標籤)?使用ng-disable單擊一次後禁用按鈕
對於初學者來說,angularjs的建議是非常值得讚賞的。
<html>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js">
</script>
<body ng-app="myApp">
<div ng-controller="myCtrl">
<p>Click the button to run a function:</p>
<button ng-click="!count && myFunc()">OK</button>
<p>The button has been clicked {{count}} times.</p>
</div>
<script>
angular.module('myApp', [])
.controller('myCtrl', ['$scope', function($scope) {
$scope.count = 0;
$scope.myFunc = function() {
$scope.count++;
};
}]);
</script>
</body>
</html>
是的,僅限於一次。 –