0

I am developing mobile application with Cordova tool and using angularJS.

I have written services in different project. I need to call those services in my cordova application, Whenever I try to call service it giving me Error:

net::ERR_CONNECTION_REFUSED

This might be browser issue or headers issue. Please suggest me right way to solve this issue.

Currently I am running service on localhost, and It is working perfectly when I call them from fiddler.

I have also open CORS in service project.

JodoModule.service("AccountSrv", function ($http) {
    this.signUp = function (user) {
        var SignUpReq = {
            method: 'GET',
            url: 'http://localhost:62676/api/Account/signin'
        }
        $http(SignUpReq).success(function () { alert("Succ"); }).error(function (data) { alert("Err = " + JSON.stringify(data)); });
    }
});

and my controller is,

JodoModule.controller("AccountCtrl", function ($scope, AccountSrv) {
    $scope.signUp = function () {
        AccountSrv.signUp();
    }
});
8
  • what Angular version you are using? In latest Angular, you don't need to do anything with Angular side to enable CORS.
    – Rebornix
    Feb 14, 2015 at 13:00
  • you can open browser's developer tool network panel to get more info about your API request failure.
    – Rebornix
    Feb 14, 2015 at 13:02
  • From the same place I got details of this error... OPTIONS localhost:4400/ripple/… net::ERR_CONNECTION_REFUSED Feb 14, 2015 at 13:04
  • what backend you are using?
    – Rebornix
    Feb 14, 2015 at 13:11
  • how about disabling cross domain proxies from the drop down right in the emulator? if this can work, I'll post it as answer.
    – Rebornix
    Feb 14, 2015 at 13:13

1 Answer 1

0

You can disable cross domain proxies in the emulator as a workaround.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.