<!DOCTYPE html> <html lang="en" ng-app="myApp"> <head> <meta charset="UTF-8"> <title>Document</title> <script type="text/javascript" src="js/angular-1.3.0.js"></script> <script> var m1 = angular.module(‘myApp‘,[]); m1.controller(‘may‘,[‘$scope‘,‘$interval‘,function($scope,$interval){ var iNow = 5; $scope.text = iNow +‘s‘; $scope.isDisable = true; var timer = $interval(function(){ iNow--; $scope.text = iNow + ‘s‘; if(iNow == 0){ $interval.cancel(timer); $scope.text = ‘pls click!‘; $scope.isDisable = false; } },1000); }]) </script> </head> <body ng-controller=‘may‘> <input type="button" ng-value=‘text‘ ng-disabled=‘isDisable‘> <input type="text" ng-value=‘text‘ ng-readonly=‘isDisable‘> <input type="checkbox" ng-value=‘text‘ ng-checked=‘isDisable‘> </body> </html>
时间: 2024-10-17 04:43:41