9
I 얻을 TypeError: Cannot call method 'get' of undefined
이 모듈을 실행하는 경우 :
angular.module('EventList', [])
.config([ '$routeProvider', function config($routeProvider){
$routeProvider.when(Urls.EVENT_LIST_PAGE, {
templateUrl: 'app/EventList/event-list.html',
controller: 'EventListCtrl'
});
}])
.controller('EventListCtrl', ['$scope', '$http', function EventListController($scope, $location, $http) {
$scope.events = [];
$http.get('http://localhost:8000/event').
success(function (data, status) {
$scope.events = data;
for (var i = 0; i < $scope.events.length; i++) {
$scope.events[i].event_url = ('#' + Urls.EVENT_PAGE + '/' + $scope.events[i]._id);
}
}).
error(function (data, status) {
$scope.data = data || "Request failed";
}
);
}]);
내가 여기서 잘못하고 그리고 난 그것을 어떻게 해결할 수 무엇을?
의 :
주요 변경 존재 : 이것에
:
당신은 그래서 이것을 변경하려면EventsListController
기능에 추가$location
서비스를 이 답변을 두 번 upvote 수 있습니다! 이것은 정확한 원인은 아니지만 도움이되었습니다. 편집인이 프로덕션에서만 사용되는 .min 파일을 업데이트하지 못하여 배포가 생산 중단과 다른 환경을 뚫지 못하는 이유를 알아 내려고 노력했습니다. 주말을 보내 주셔서 감사합니다! –