标签:特性 相互 顺序 put 文件 cat 动态 简单 tree
<!DOCTYPE html>
<html ng-app="appModule">
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="../angular.js"></script>
</head>
<body ng-controller="AppController">
<p></p>
</body>
<script>
//定义一个模块
var app=angular.module(‘appModule‘,[]);
//在这个模块中添加一个控制器
app.controller(‘AppController‘,[‘$scope‘,function($scope){
}]);
</script>
</html>
看看代码就知道是怎么实现的:
<!DOCTYPE html>
<html ng-app="appModule">
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="../angular.js"></script>
</head>
<body>
<div ng-controller="AppController1">
<p>控制器1</p>
</div>
<div ng-controller="AppController2">
<p>控制器2</p>
</div>
<div ng-controller="AppController3">
<p>控制器3</p>
</div>
</body>
<script>
//定义一个模块
var app=angular.module(‘appModule‘,[]);
app.controller(‘AppController1‘,[‘$scope‘,function($scope){
}]);
app.controller(‘AppController2‘,[‘$scope‘,function($scope){
}]);
app.controller(‘AppController3‘,[‘$scope‘,function($scope){
}]);
</script>
</html>
<body>
<input type="number" id="txt_value"/>
<input type="button" value="增加" id="btn_add"/>
</body>
<script>
(function () {
var txt=document.getElementById(‘txt_value‘);
var btn=document.getElementById("btn_add");
//监听按钮的点击事件 当我点击按钮的时候进行以下操作
btn.addEventListener(‘click‘,function(event){
var now=txt.value-0; //这是把字符串强制转换成数字的一种简单方法
now=now+1;
txt.value=now;
});
})();
</script>
</html>
<!DOCTYPE html>
<html ng-app="appModule">
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="../angular.js"></script>
</head>
<body>
<div ng-controller="AppController">
<input type="number" ng-model="value"/>
<input type="button" value="增加" ng-click="value=value+1"/>
</div>
</body>
<script>
var app=angular.module(‘appModule‘,[]);
app.controller(‘AppController‘,[‘$scope‘,function($scope){
}])
</script>
</html>
<!DOCTYPE html>
<html ng-app="myApp">
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="../angular.js"></script>
</head>
<body ng-controller="DemoController">
<div>
<input type="text" ng-model="value"/>
<h1>{{value}}</h1>
</div>
</body>
<script src="../angular.js"></script>
<script>
var app=angular.module(‘myApp‘,[]);
app.controller(‘DemoController‘,function(){
})
</script>
</html>
标签:特性 相互 顺序 put 文件 cat 动态 简单 tree
原文地址:http://www.cnblogs.com/webenh/p/6011437.html