<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="js/angular.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
</head>
<body ng-app = ‘moduleOne‘>
<!--模块控制的范围-->
<div ng-controller="indexC">
<p>{{name}}</p>
<p>{{obj.a}}</p>
</div>
<div ng-controller="indexD">
<p>{{name}}</p>
</div>
<div ng-controller="indexE">
<p>{{name}}</p>
</div>
</body>
<script type="text/javascript">
console.log(angular);
//定义第一个模块,2个参数模块名,数组(引人其他模块的名字)
// 定义一个控制器名,与一个函数
angular.module(‘moduleOne‘,[]).controller(‘indexC‘,function($scope){
$scope.name = ‘laoxie‘;
$scope.obj = {
a:‘1‘,
b:‘2‘
};
$scope.num =10;
}).controller(‘indexD‘,function($scope){
$scope.name = ‘laoyao‘;
}).controller(‘indexE‘,function($scope){
$scope.name = ‘laohe‘;
})
</script>
</html>