<div id="1" ng-app="myApp" ng-controller="ctrl">
<table>
<tr ng-repeat="id1 in IDS1">
<td>{{ id1 }}</td>
<td>
<button class="btn btn-success" ng-click="update(this,0)">anwo</button>
</td>
</tr>
</table>
</div>
<div id="2" ng-app="myApp2" ng-controller="ctrl2">
<table>
<tr ng-repeat="id2 in IDS2">
<td>{{ id2 }}</td>
<td>
<button class="btn btn-success" ng-click="update(this,0)">anwo</button>
</td>
</tr>
</table>
</div>
页面中如果存在多个ng-app,则只有第一个会被解析。
解决办法:
//手动启动其他ng-app
//等待页面加载完成后,再解析ng-app
angular.element(document).ready(function() {
//第一个模块自动加载
//angular.bootstrap(document.getElementById("div1"),["moudle1"]);
angular.bootstrap(document.getElementById("div2"),["moudle2"]);//手动加载
});