Angular factory $资源:404 Not Found

时间:2016-09-21 12:05:04

标签: angularjs node.js github

我是Angular的新手,我一直在研究Airline SPA,它从json文件中读取样本数据。在nodejs(localhost:3000 / Airports)上运行时,该应用程序运行正常,但是当我在github上查看它时显示此错误:GET https://nlmazhari.github.io/airports 404 Not Found

这是我的app.js:



angular.module('airline', ['airlineServices'])
    .config(airlineRouter);

function airlineRouter ($routeProvider) {
	$routeProvider
		.when('/', {templateUrl: 'partials/destinations.html',
		 controller: 'DestinationsCtrl'})
		.when('/airports/:airportCode', {
		 templateUrl: 'partials/airport.html',
		 controller: 'AirportCtrl'
		})
		.when('/flights', {
		 templateUrl: 'partials/flights.html',
		 controller: 'FlightsCtrl'})
		.when('/reservations', {
		 templateUrl: 'partials/reservations.html',
		 controller: 'ReservationsCtrl'});
}



 这些是我的控制者:



function AirportCtrl ($scope, $routeParams, Airport) {
	$scope.currentAirport = Airport.get({
		airportCode: $routeParams.airportCode
	});
}






function DestinationsCtrl ($scope, Airport) {
 	$scope.setActive('destinations');

  $scope.sidebarURL = 'partials/airport.html';
  $scope.currentAirport = null;

  $scope.setAirport = function (code) {
    $scope.currentAirport = Airport.get({airportCode: code});
  };

  $scope.airports = Airport.query();
}




这是我的services.js:



angular.module('airlineServices', ['ngResource'])
	.factory('Airport', function  ($resource) {
		return $resource('/airports/:airportCode');
	})
	.factory('Flights', function  ($resource) {
		return $resource('/flights');
	})
	.factory('Reservations', function  ($resource) {
		return $resource('/reservations');
	});




任何人都可以指导我吗?为什么我会收到此错误?

0 个答案:

没有答案