5
다음과 같이 ui-router의 위키에서 약간 수정 된 코드를 고려하십시오. 액세스하려고 할 때 파이썬 3의 SimpleHttpServer 실행
var myApp = angular.module('myApp',['ui.router']);
myApp.config(function($stateProvider, $urlRouterProvider, $locationProvider) {
// for any unmatched url
$urlRouterProvider.otherwise("/state1");
$locationProvider.html5Mode(true);
// now set up the states
$stateProvider
.state('state1', {
url: '/state1',
templateUrl: "partials/state1.html"
})
.state('state1.list', {
url: "/list",
templateUrl: "partials/state1.list.html",
controller: function($scope) {
$scope.items = ["A", "List", "of", "Items"];
}
})
.state('state2', {
url: "/state2",
templateUrl: "partials/state2.list.html",
controller: function($scope) {
$scope.things = ["a", "set", "of", "things"];
}
})
});
, 나는 404 error
를 얻을 : http://localhost:8000/state1234324324
.
/state1
URL과 관련된 정의
state
을 가지고
/state1
로하지
$urlRouterProvider.otherwise("/state1");
다시 직접 모든 알 수없는 경로 했습니까?
왜 ui-router에서 제대로 작동하지 않습니까? 그렇지 않으면 지금은 작동하지만, 그 수정을 추가 한 이후로 내 경로가 작동하지 않습니다 ... –