In the process of developing a small Angular application, I started with this seed project: https://github.com/angular/angular-seed. The only modifications I made were to 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>
However, upon displaying the page, I received an error message that says:
"error undefined | undefined".
Despite checking through the code multiple times, I couldn't figure out why the JSON file is not loading. Interestingly, when I directly access http://localhost:8000/app/data/events.json in the browser, the JSON data is successfully loaded.
This predicament leads me to ask: what could be causing the failure to load the JSON file?