had gone through many forums, even in stackoverflow for a workaround for the error: XMLHttpRequest cannot load file:///.... Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
Though there are solutions like using Node.js, app and source needs to be hosted in a http server, I need a workaround so that I could test my $http get() in local.
I have also tried, starting chrome with --allow-file-access-from-files --disable-web-security, but no luck.
So, can any one help me running my $http get() in local without server? Or is it mandatory to go for a server?
Below is my code.
app.factory('jsonFactory', function($http) {
var obj = {};
$http.get("response.json").then(function (response) {
obj = response.data;
});
return {
get: function () {
return obj;
}
};});