<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body ng-app="myApp">
<div ng-controller="filterController">
{{text}}
</div>
<div ng-controller="filterController1">
{{texttt}}
</div>
<script type="text/javascript" src="js/angular.js"></script>
<script type="text/javascript">
angular.module("myApp",[]);
angular.module("myApp").controller("filterController",["$scope",function($scope) {
$scope.text = "hello";
}]);
angular.module("myApp").controller("filterController1",["$scope",function($scope){
$scope.text = "world";
}]);
</script>
</body>
</html>
angular中为一个module创建多个controller
最新推荐文章于 2020-05-18 23:22:56 发布