이 AngularJS 구성 코드의 문제점은 무엇입니까?AngularJS의 라우팅 오류
(function() {
var ip = 'x.x.x.x';
var app = angular.module('cmal', ['controllers', 'directives', 'services', 'ngRoute'])
.constant("baseUrl", "http://" + ip + ":303/angular")
.config(function ($routeProvider, $locationProvider) {
$locationProvider.html5Mode(true);
$routeProvider.when('/', { templateUrl: "index.html"});
$routeProvider.when('/users', { templateUrl: "users.html"});
$routeProvider.otherwise({template: "Sorry, the page you are trying to reach doesn't exist."});
});
})();
편집 : 슬래시 오류가 아닙니다. 이것은 여전히 나를 위해 작동하지 않으며 내가 콘솔에 "잡히지 않는 개체"입니다.
EDIT 2 : 라우팅을 위해 다른 js 스크립트를 가져와야한다는 것을 알지 못했습니다. 그러나 이제는 그렇게 했으므로 아무런 오류가 없지만 경로가 작동하지 않습니다.
정확히 무엇이 문제입니까? 언뜻 보면 상수 정의에서 포트 번호 (303)와 경로 (각) 사이에 /가 없음을 나타냅니다. –
이 비트를 다시 확인하십시오 : '303angular' : – martynas
내 편집 된 메모 읽기 ... –