0
當我打開反彈時,單選按鈕的切換速度非常慢。半秒鐘後,我看到兩個按鈕都已啓用,然後舊的按鈕清除。它工作正常,但在視覺上很煩人。單選按鈕速度變慢,角度反跳啓用
注意:我找到了答案,我只是發佈這個爲他人學習。
這裏是我的代碼
<!doctype html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.17/angular.min.js"></script>
</head>
<body ng-app="formExample">
<div ng-controller="ExampleController">
<form novalidate ng-model-options="{ debounce: { default: 500 } }">
<input type="radio" ng-model="formdata.t1" value="yes" />
<input type="radio" ng-model="formdata.t1" value="no" />
<input type="radio" ng-model="formdata.t1" value="na" />
<input type="button" ng-click="reset()" value="Reset" />
<input type="submit" ng-click="update(formdata)" value="Save" />
</form>
<pre>form = {{formdata | json}}</pre>
<pre>master = {{master | json}}</pre>
<script>
angular.module('formExample', [])
.controller('ExampleController', ['$scope', function($scope) {
$scope.master = {};
$scope.update = function(formdata) {
$scope.master = angular.copy(formdata);
};
$scope.reset = function() {
$scope.formdata = angular.copy($scope.master);
};
$scope.reset();
}]);
</script>
</body>
</html>