展开全部
不要声明两次 var app
<body ng-app="b">
<div ng-controller="myCtrl" >
{{5+5}}+{{carname}}
</div>
<script>
var app = angular.module('b', []);
app.controller('myCtrl', function($scope) {
$scope.carname = "aaa";
});
</script>
<div ng-controller="myCtrl2">
<h1>{{carname}}{{5+10}}</h1>
</div>
<script>
app.controller('myCtrl2', function($scope) {
$scope.carname = "Volvo";
});
</script>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询