Hi, The concept here what I am doing is, sending the post request to the other domain for retrieving the details by using $resource...
I got struck by using $resource..please see the below error.. XMLHttpRequest cannot load http://exampledomian.com/api/getCountries/123web/0/0/0<http://radiostring.com/api/getCountries/123web/0/0/0>. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000 <http://127.0.0.1/>' is therefore not allowed access. *factory.js* var factories = angular.module('AngularApp.factories',[]); factories.factory("ApiListFactory", ['$resource', function($resource) { return $resource('http://exampledomian.com<http://radiostring.com/api/getCountries/123web/0/0/0> /api/getCountries/:ain/:rtmp/:aacp/:mms', {ain:'123web', rtmp :0,aacp:0,mms:0},{req:{method:'POST' }}); }]); *Controller.js* var AngularApp = angular.module('AngularApp', ['ngRoute','ngResource','AngularApp.factories']); AngularApp.config(function($interpolateProvider){ $interpolateProvider.startSymbol('{$'); $interpolateProvider.endSymbol('$}'); }); AngularApp.config(function($httpProvider) { //Enable cross domain calls $httpProvider.defaults.useXDomain = true; //Remove the header used to identify ajax call that would prevent CORS from working delete $httpProvider.defaults.headers.common['X-Requested-With']; $httpProvider.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded"; }); AngularApp.config(['$routeProvider',function($routeProvider){ $routeProvider. when('/',{ templateUrl: '/static/ag_template/apiList.html', controller:'MainController' }); }]); AngularApp.controller('MainController',['$scope','ApiListFactory', function($scope,ApiListFactory){ var hi=ApiListFactory.req(); console.log(hi); }]); -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/groups/opt_out.
