我有一個HTML頁面上的數據存儲在數據庫中的表。我希望只有在收到數據後才能加載表格或整個頁面。我可以這樣做嗎?AngularJS從數據庫獲取響應後如何加載HTML頁面?
AngularJS代碼:
angular.module("app", []).controller("controller", function($scope, $http) {
$http({
method: 'POST',
url: 'updateCoins.php',
data: {get: 1},
}).then(function(response){
$scope.db = response.data;
});
});
表得到填補這樣的:
<tr>
<td>{{db[0]['percent']}}%</td>
</tr>
這是不是以某種方式工作?AJAX調用是否成功?什麼在響應中? – David
只需閱讀有關ngIf ngHide ngShow,太基本了 –