Kumar Sambhav
Kumar Sambhav

Reputation: 7765

jQuery.ajaxStart equivalent in AngularJS | Ajax event handler in AngularJS

I am trying to capture ajax start and end event in a AngularJS. While using JQuery, one can use ajaxStart, ajaxComplete etc to capture start,complete,end,fail events globally(or locally) in an application.

How can I globally track ajax events(start,end,failed) using AngularJS? I am trying to show busy indicator and disable UI during an AJax call.

Upvotes: 2

Views: 2756

Answers (1)

harishr
harishr

Reputation: 18055

you should use $http whiile making ajax request in angulajs. then you can use the http interceptor for showing the spinner. below are links of implementation for similar requirement.

angular-spinner or angular-sham-spinner

also read this BLOG which details how should that be implemented in case you decide to implement it yourself.

Upvotes: 1

Related Questions