标签:ready 应用程序 head style title set char blog class
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title></title> 6 </head> 7 <body ng-app="ickt"> 8 <div class="main" ng-controller="main"> 9 用户名:<input ng-model="username" type="text" ng-readonly="readOnly"><button ng-click="toggle()">编辑</button> 10 </div> 11 <script type="text/javascript" src="angular.js"></script> 12 <script type="text/javascript"> 13 // 获取应用程序 14 var app = angular.module(‘ickt‘, []); 15 // 定义控制器 16 app.controller(‘main‘, function ($scope) { 17 // 定义绑定的数据 18 $scope.username = ‘ickt‘; 19 // 定义控制变量 20 $scope.readOnly = true; 21 $scope.toggle = function () { 22 // 切换状态 23 $scope.readOnly = !$scope.readOnly; 24 } 25 }) 26 </script> 27 </body> 28 </html>
标签:ready 应用程序 head style title set char blog class
原文地址:http://www.cnblogs.com/zrdy/p/7045156.html