angularjs - Angular JS Cross Domain Issue -


i using angularjs $resource data using jsonp.

 app.controller('hello', ['$scope', 'phone', function($scope, phone,$http) {    $scope.data=phone.query();  }]); mycallback = function(data,$scope){   alert(data.found); };  app.factory('phone', ['$resource',function($resource){ return $resource('http://public-api.wordpress.com/rest/v1/sites/wtmpeachtest.wordpress.com/posts?callback=mycallback', {}, {   query:      {         method:'jsonp',          params:{},          isarray:false,         callback: 'json_callback'      } }); }]); 

the error console shows "uncaught syntaxerror: unexpected token :". please let me know, how best can handle jsonp data.

you have include $scope in factory before accessing it.

app.factory('phone', ['$resource','$scope',function($resource,$scope){} ]); 

Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -