I'm trying a very simple thing in Angular: Call a json file via $http ...
angular.module('testApp', [])
.controller('TripCtrl', function ($scope, $http) {
$http.get('http://localhost:8080/mydir/myfile.json').
success(function (data, status, headers, config) {
$scope.text = 'Success!';
}).
error(function (data, status, headers, config) {
$scope.text = 'Error';
});
});
There is no success, the error function is always called. Path to json is correct (json is found). Firebug shows HTTP 200. Tried with different WebServers (Apache from XAMPP, IIS Express from WebStorm).
There is no error message, but config shows:
Config: {"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"http://localhost:8080/mydir/myfile.json","headers":{"Accept":"application/json, text/plain, */*"}}