Am wondering is it possible fetch data from an external api using ngresource in angularjs.`
var brk = angular.module('service', ['ngResource']);
brk.factory('ListingFactory', function ($resource) {
return $resource("http://bonches.cloudapp.net/product/index", {}, {
query: { method: 'GET', isArray: true },
create: { method: 'POST' }
})
});
brk.factory('ListingsFactory', function ($resource) {
return $resource('http://bonches.cloudapp.net/product/index', {}, {
show: { method: 'GET' },
update: { method: 'PUT', params: {id: '@id'} },
delete: { method: 'DELETE', params: {id: '@id'} }
})
});
when i run that it maps the url over the enviroment am working under like localhost:8000/http://bonches.cloudapp.net/product/index.
$httprequest interceptors that might be changing your absolute urls.