找了個開源基礎框架測試一下微信公眾號。沒想是用jquery做的restful風格的頁面。jquery更
新table中數據就有些麻煩。所以用angularjs重構一下。
頁面中angularjs展示數據
<body ng-controller="multi">
<table id="baseTable" class="table table-striped table-bordered table-hover" >
<thead>
<tr><th style="width:10%" class="center">標題</th>
</tr>
</thead>
<body ng-controller="multi">
<tbody>
<tr ng-repeat="item in defaultData " >
<td class='center hidden-480'>{{item.title}}</td>
</tr>
</tbody>
</body>
</table>
</body>
外部jquery的ajax調用更新數據
var controllerScope = $('body[ng-controller="multi"]').scope();
controllerScope.defaultData=results;
controllerScope.$apply();
注意:外部js不要刪除了下面這段代碼塊。
<tr ng-repeat="item in defaultData " >
<td class='center hidden-480'>{{item.title}}</td>
</tr>