Index.html
<body>
<div ng-app="myApp">
<div ng-controller="firstController">
{{name}}
</div>
<div ng-controller="secondController">
{{name}}
</div>
<div ng-controller="thirdController">
{{name}}
</div>
</div>
<script type="text/javascript">
var app = angular.module("myApp", ['myApp2']);
app.controller('firstController', ['$scope', function ($scope) {
$scope.name = "张三";
}]);
</script>
</body>
Modules.js
//张三,李四,王五全部输出 var app2 = angular.module("myApp2", []); app2.controller('secondController', ['$scope', function ($scope) { $scope.name = "李四"; }]); app2.controller('thirdController', ['$scope', function ($scope) { $scope.name = "王五"; }]);