https://groups.google.com/d/msg/angular/1mJDBBr0dug/05a4LJLTB4oJ
There is also a simpler method (have not checked that yet), using
ng-cloak directive, but you would have to find yourself how does the
ng-clock affect the class of element and adapt the CSS rules
accordingly.
On 14 March 2012 23:16, Matthias Andrasch
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/angular/-/qsV7XvP_EAoJ.
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to
> angular+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/angular?hl=en.
Hi,
I have done it in my application. There was a discussion about this
some time ago, I have provided my solution:https://groups.google.com/d/msg/angular/1mJDBBr0dug/05a4LJLTB4oJ
There is also a simpler method (have not checked that yet), using
ng-cloak directive, but you would have to find yourself how does the
ng-clock affect the class of element and adapt the CSS rules
accordingly.
On 14 March 2012 23:16, Matthias Andrasch
<matthias.andrasch@googlemail.com> wrote:
> Hey,
>
> quick question:
>
> Has somebody implemented a solution for showing a loading/spinning animation
> while an ajax request (for a certain area) is loaded? Where could I attach
> this?
>
> Best regards,
> Matthias
>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/angular/-/qsV7XvP_EAoJ.
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to
> For more options, visit this group at
> http://groups.google.com/group/angular?hl=en.
Hi,
I have done it in my application. There was a discussion about this
some time ago, I have provided my solution:https://groups.google.com/d/msg/angular/1mJDBBr0dug/05a4LJLTB4oJ
There is also a simpler method (have not checked that yet), using
ng-cloak directive, but you would have to find yourself how does the
ng-clock affect the class of element and adapt the CSS rules
accordingly.
On 14 March 2012 23:16, Matthias Andrasch
<matthias.andrasch@googlemail.com> wrote:
> Hey,
>
> quick question:
>
> Has somebody implemented a solution for showing a loading/spinning animation
> while an ajax request (for a certain area) is loaded? Where could I attach
> this?
>
> Best regards,
> Matthias
>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/angular/-/qsV7XvP_EAoJ.
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/D_U0KS34P4MJ.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
<div ng-include src="url" onload="onLoad()" ng-show="loaded"></div>
<button ng-click="loadTemplate(test1.htm)">Load 1</button>
<button ng-click="loadTemplate(test2.htm)">Load 2</button>
I would update the scope.loaded when the data arrives. I.e. In the success callback
...from my mobile.
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/KI4xHe7Uq4kJ.
To unsubscribe from this group, send email to angular+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/AfpLQP-8V1MJ.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
--
To unsubscribe from this group, send email to angular+unsubscribe@googlegroups.com.
angular.module('RequestResponseNotifier', []) .config(function ($httpProvider) { $httpProvider.responseInterceptors.push('myHttpInterceptor'); var spinnerFunction = function (data, headersGetter) { // todo start the spinner here var scope = angular.injector(['ng']).get('$rootScope'), headers = headersGetter(), isResourceRequest = headers['Content-Type'] === "application/json"; if (isResourceRequest && scope) { console.log('start spinner'); scope.$broadcast('loadingDataStart'); } return data; }; $httpProvider.defaults.transformRequest.push(spinnerFunction); })
// register the interceptor as a service, intercepts ALL angular ajax http calls
.factory('myHttpInterceptor', function ($q, $window, $rootScope) { return function (promise) { return promise.then(function (response) { // do something on success
// todo hide the spinner
var headers = response.headers(), isNotResourceResponse = headers['content-type'] !== "application/json; charset=utf-8"; if (isNotResourceResponse) { return response; } console.log('stop spinner'); $rootScope.$broadcast('loadingDataEnd'); return response; }, function (response) { // do something on error
// todo hide the spinner
var headers = response.headers(), isNotResourceResponse = headers['content-type'] !== "application/json; charset=utf-8"; if (isNotResourceResponse) { return response; } $rootScope.$broadcast('loadingDataEnd'); console.log('stop spinner'); return $q.reject(response); }); }; });
however, the loadingDataStart event is not propagated to the rootscope.
thanks, for any help
finally I've found $http.pendingRequest, it enables my to monitor pending requests and display alert.
Please do not remove this property from Api because I've notice that the property is for debugging purpose
angular.module('ResourceLoadingNotification', []) .directive('resourceLoadingNotification', function factory($http) { var directiveDefinitionObject = { template: '<div class="row">' + '<div class="offset4 span4" >' + '<div class="alert" ng-hide="isLoadingAlertHidden()">' + '<strong >Proszę czekać. Następuję odczytywanie danych.</strong>' + '</div>' + '</div>' + '</div>', replace: true, restrict: 'E', link: function postLink(scope, iElement, iAttrs) { scope.isLoadingAlertHidden = function () { return $http.pendingRequests.length === 0; }; scope.$watch(scope.isLoadingAlertHidden, function (parameters) { console.log("isLoadingAlertHidden" + scope.isLoadingAlertHidden()); }); } }; return directiveDefinitionObject; });
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en-US.