angularjs - Restangular with JSONP -


i'm trying use jsonp restangular. i'm using songkick api , when making request i'm receiving no response data different domain locally receive data no problem.

i've created following factory configuring restangular , controller. i'm little unsure how use setdefaultrequestparams. maybe configuration incorrect?

angular     .module('modulename')     .factory('restfactory', factory);  function factory (restangular) {     var factory = {         songkick: songkick     };      return factory;      function songkick () {         return restangular.withconfig(function(restangularconfigurer) {             restangularconfigurer.setjsonp = true;             restangularconfigurer.setdefaultrequestparams('jsonp', {                 callback: 'json_callback'             });              restangularconfigurer.setdefaultrequestparams('get', {                 reason: 'attendance',                 apikey: 'xxxxxxxxxx'             });              restangularconfigurer.setbaseurl('http://api.songkick.com/api/3.0/');             restangularconfigurer.setrequestsuffix('.json');             restangularconfigurer.setdefaulthttpfields({cache: true});         });     }  }   angular     .module('modulename')     .controller('usercontroller', controller);  function controller ($stateparams, restfactory) {     var user = this;      activate();      function activate () {         restfactory.songkick().one('users/'+$stateparams.username+'/calendar')             .get()             .catch(function(response){                 console.log("error status code", response.status);             });     }  } 

did miss jsonp option settings restangular? following:

//jsonp restangularprovider.setjsonp(true); restangularprovider.setdefaultrequestparams('jsonp', {callback: 'json_callback'}); 

documented here


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -