Data null restfyl webservice php, ionic, angular in the device android


#1

Good night guys , I’m the great hum pace tendon problem to run my app consuming webservice restfyl , Where You insert headers Necessary but STILL does not work on Android ( APK ) WHEN installed, not Brings No results , follow my angular source code:

.factory(“services”, [’$http’, function($http) {
var serviceBase = 'http://www.eventoexpress.com.br/sigprojeto/services/'
var obj = {};
obj.getCustomers = function(){
return $http.get(serviceBase + ‘customers’);
}
return obj;
}])
.controller(‘AppRodinei’, function($scope, $http, services) {

$scope.getData = function() {
    services.getCustomers().success(function(data){
      console.log('OK', data);
      $scope.posts = data;
    })
    .error(function(data, status, headers, config) {
        alert(data);
        alert(status);
        alert(headers);
        alert(config);
    });
}

});

Restfil headers
private function set_headers(){
header("HTTP/1.1 “.$this->_code.” ".$this->message());
header(“Content-Type:”.$this->_content_type);
header(‘Access-Control-Allow-Origin: *’);
header(‘Access-Control-Allow-Credentials: true’);
header(‘Access-Control-Allow-Methods: GET,PUT,POST,DELETE’);
header(‘Access-Control-Allow-Headers: DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type’);
}

On my machine http : // localhost: 8100 / drying normal for json results, but when running on cell brings NULL , does anyone have idea how to solve ??? Help me …


#2

Consegui resolver galera, faltou add um plugin ( ionic plugin add cordova-plugin-whitelist)