Reputation: 1727
Try to read a local file. Get the following error. I've tried all the Angular CORS tricks. But no luck any ideas what I'm doing wrong. Should work
XMLHttpRequest cannot load file:///C://www/mapping.json. Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https, chrome-extension-resource.
var App = angular.module('Search', ['ngResource', 'ionic'])
.config(function ($httpProvider) {
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
});
var x = $http.get('mapping.json');
Upvotes: 0
Views: 83
Reputation: 575
CORS required server side header: Access-Control-Allow-Origin
not sure how that works with plain files,
please see for more info: http://enable-cors.org/
Upvotes: 1
Reputation: 1693
Maybe you have a file permission error and you don't have the rights to read the file. Try changing the permissions of that folder
Upvotes: 0