0
加載頁面
我採用了棱角分明的路由器表是空白永遠 - 與ngRoute
app.config(function($routeProvider) {
$routeProvider
.when('/comment/list', {
templateUrl: 'commentList.htm',
controller: 'mainController'
})
});
<td ng-show="btnUADetails" ng-click="loadPage('commentList', x.userName);">
<a class="detailButton" href="#/comment/list"></a>
</td>
,這裏是我的角度功能
$scope.loadPage = function(pageId, id) {
if (pageId == "commentList") {
$scope.getServerData($scope.generateUrl(pageId, 'json', id)).then(function(result) {
$scope.serverComment = result;
});
} else {
//do something
}
}
之前$ HTTP返回響應HTML頁面加載我在html表格中獲得乾淨的數據。我的函數返回結果後可以加載這個頁面嗎?或者先加載html文件並在函數返回結果時再次加載它?
您可以使用ng-if =「result」,然後在加載頁面時顯示結果 – Vivz
您是否獲取數據並使用新數據更新視圖?你唯一的問題是桌子空了一會兒? –
nope我的問題是,表是永遠是空的。頁面加載之前,我得到了響應使用$ HTTP –