javascript - AngularJS - How to display message "Loading..." while the content is being loaded? -
i found threads topic on so, looks way of loading data isn't best.
this how controller looks like:
app.controller("postsctrl", ['$scope', '$http', '$resource', 'posts', 'post', '$location', '$modal', '$timeout', function($scope, $http, $resource, posts, post, $location, $modal, $timeout) { $scope.posts = posts.query(); ... add/edit/delete code
when page loaded, data db not displayed immediately. how display there loading...
message?
i've tried using <div ng-if="loading">loading...</div>
in view ,
$scope.loading = true; $scope.posts = posts.query(); $scope.loading = false;
in angularjs controller, doesn't seems working. i've noticed $scope.posts = posts.query();
executed every time when there's call controller.
is (or angularjs) way solve matter?
thank in advance.
what about
$scope.loading = true; $scope.posts = posts.query(function () { $scope.loading = false; });
Comments
Post a Comment