Cross-Origin Request Blocked with POST But working fine with req on Browser but on device not working

I am trying to build an application using ionic. I am using this code

var req =
method: ‘POST’,
url: API_END_POINT + “/accounts/login”,
data: this.toparams(myobject),
headers: {‘Content-Type’: ‘application/x-www-form-urlencoded’}

                success(function(data, status, headers, config) 
                   if(data.result = 'success') {
            console.log('Success', data);
        } else {
                error(function(data, status, headers, config) 
        return deferred.promise;


This is working fine on browsers but not on device …

Even if i tired using this method

var link = API_END_POINT +“/accounts/login”;

$, {username : $,password:$}).then(function (res){
$scope.response = res;
This gives me CORS error on browser.

Any idea ?