Angular 学习笔记——ng-disable

<!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>

 

posted @ 2015-11-25 00:46  mayufo  阅读(763)  评论(0编辑  收藏  举报