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();
    }
});
Keval Patel
  • 925
  • 4
  • 24
  • 46
  • 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 '15 at 13:00
  • you can open browser's developer tool network panel to get more info about your API request failure. – Rebornix Feb 14 '15 at 13:02
  • From the same place I got details of this error... OPTIONS http://localhost:4400/ripple/xhr_proxy?tinyhippos_apikey=ABC&tinyhippos_rurl=http%3A//localhost%3A62676/api/Account/signin net::ERR_CONNECTION_REFUSED – Keval Patel Feb 14 '15 at 13:04
  • what backend you are using? – Rebornix Feb 14 '15 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 '15 at 13:13
  • For storing data SQL SERVER 2012 For service, Visual Studio 2013... I have already open CORS, So I am able to call services from Fiddler, but not from client app. :( – Keval Patel Feb 14 '15 at 13:13
  • it might be ripple emulator issue, let me know if the workaround works – Rebornix Feb 14 '15 at 13:19
  • I already posted it. You may want to mark it as correct :) – Rebornix Feb 14 '15 at 13:22

1 Answers1

0

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

Rebornix
  • 5,272
  • 1
  • 23
  • 26