在页面中还是只有一个ng-app,但是在js代码中创建多个app。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="js/angular.min.js"></script>
</head>
<body>
<div ng-app="app">
<div ng-controller="cons1">
{{name}}
</div>
<div ng-controller="cons2">
{{name}}
</div>
<div ng-controller="cons3">
{{name}}
</div>
</div>
<script type="text/javascript">
var app1 = angular.module('frist',[]);
var app2 = angular.module('second',[])
var app = angular.module('app',['frist','second']);
app1.controller('cons1',function($scope){
$scope.name = "11"
});
app1.controller('cons2',function($scope){
$scope.name = "22"
});
app1.controller('cons3',function($scope){
$scope.name = "33"
});
</script>
</body>
</html>