I'm building a small angular application. I've started from here: https://github.com/angular/angular-seed. I've changed only the following files:
/app/view1/view1.js 'use strict';
angular.module('myApp.view1', ['ngRoute']) .config(['$routeProvider', function($routeProvider) { $routeProvider.when('/view1', { templateUrl: 'view1/view1.html', controller: 'View1Ctrl' }); }]) .controller('View1Ctrl', ['$scope', '$http', function ($scope, $http) { $http.get('/app/data/events.json').success(function(data) { $scope.events = data.record; }).error(function(data, status){ alert("error "+data+' | '+status); }); $scope.orderProp = 'date'; }]);/app/view1/view1.html
p>Available Events</p> <div ng-controller="EventListController"> <ul> <li ng-repeat="event in events"> <p>{{event.name}}</p> <div>{{event.location}}</div> <div>{{event.description}}</div> <div>{{event.date}}</div> </li> </ul> <p>Total number of events: {{events.size}}</p> </div>
When the page is displayed I get the following message:
"error undefined | undefined".
I've checked the code several times and I did not find why the json file is not loaded. If I try to access http://localhost:8000/app/data/events.json in browser the json data is loaded.
The question is: why json file is not loaded?