Setting up JSONP callback function in AngularJS
I am trying to fetch data from a web API via the Angular $ resource service. The service exposes the JSONP interface, but does not allow you to set the callback name. Everything works well, my requests disappear, data is returned, a script is injected and then it fails because the callback function is not defined.
Angular documentation is very sparse, but it seems that the default Angular callback function sets:, JSON_CALLBACK
and there is no information on how to change this to match the function returned by foreign APIs.
Thank.
source to share
I don't think there is any condition to cancel this callback.
$ resource is high level. A recovery api based on the $ http service.
You can use $ http apis which returns a promise object and allows you to write a success callback where you can handle the data returned from the ajax request.
source to share