N
N
Nikita Musikhin2015-12-06 21:04:23
Angular
Nikita Musikhin, 2015-12-06 21:04:23

How to organize a cross-domain request in AngularJS?

Good day, the question is the following, I have a service that returns an object with resources for various requests of this kind

angular.module('myModule')
.constant('url','http://api.domain.com/')
.factory('service',['....',
function(.....){
return {
        auth : $resource(url,{},{
            login:{
                method:'POST'
            }
        }),
....

the question is what needs to be written in order for these queries to work cross-domain

Answer the question

In order to leave comments, you need to log in

2 answer(s)
_
_ _, 2015-12-06
@AMar4enko

CORS support on the server, nothing is needed on the client.

N
Nick Nesterov, 2015-12-06
@njnesterov

Maybe JSONP will help. See documentation! https://docs.angularjs.org/api/ng/service/$http

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question