问题描述:
使用angularjs集成footable,通过ajax加载数据后,页面分页及样式没有刷新。
现象:
NameLogoWebsiteURLExternal Parameter 1External Parameter 2Meta KeywordsMeta DescriptionPeriodAction
{{store.name}}正常样式应该如:
但偶尔会出现这样情况:
angularjs相关代码如下:
app.controller('storesCtrl', ['$scope', '$http', function($scope, $http) {
$scope.stores = {};
$http.get("http://MyApiUrl/store.php").
success(function(data){
$scope.stores = data;
//$('.table').trigger('footable_redraw');
});
}]);
解决方案:
success(function(data){
$scope.stores = data;
$timeout(function(){
$('.table').trigger('footable_redraw');
}, 100);
});
以上$timeout代码段加入到controller后,问题解决。