angularjs - Calling external Vimeo API from Angular $http -
i've been trying call external api (vimeo) angularjs code, 304 not modified. code:
this.$scope.$safeapply(() => { this.$http.jsonp('http://vimeo.com/api/v2/video/75532980.json?callback=?') .success((r) => { this.$log.info("success: " + r); }) .error((e) => { this.$log.info("error: " + e); }); });
the odd thing when call same url fiddler, seems ok , 200 response correct json.
here working plunker: http://plnkr.co/edit/pz7rqxb3gureqgfsodhx?p=preview
i took answer from: angularjs caching jsonp default
you add timestamp query not cached angular. also, modified value of callback json_callback per doc (angularjs $http).
relative or absolute url specifying destination of request. should contain json_callback string.
$http.jsonp('http://vimeo.com/api/v2/video/75532980.json?callback=json_callback&_=' + (new date().gettime())) .success(function (r) { $log.info("success: " + r); }) .error(function (e) { $log.info("error: " + e); });
Comments
Post a Comment