I'm creating android application in Cordova witch consume a REST service using AngularJs, I test this application first on browser by this URL file:///C:/Users/Users/MyApps/project/platforms/android/assets/www/index.html#/demande/list but that stil give this Error :
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://10.0.2.2:8080/springrestprojet/rest/demande. Reason: CORS request failed.
I'm sing CORS filter for enabling access. this is my code of service.js :
'use strict';
angular.module('workflowService', ['ngResource']).
factory('Demande', function ($resource) {
return $resource('http://10.0.2.2:8080\:8080/springrestprojet/rest/demande/:id', {}, {
'save': {method:'PUT',
headers: {'Content-Type': 'application/json',
'Access-Control-Allow-Origin':'*',
'Access-Control-Allow-Methods' : 'POST, GET, OPTIONS, PUT',
'Access-Control-Request-Method':'*',
'Access-Control-Allow-Headers':'*',
'Accept': 'application/json'}},
});
});
Any help please ? Thanks a lot.