我似乎无法让我的路由(ngRoute
)接收到子页面(/login/create
)。每当我尝试访问该路线时,我都会被推回到开头("/"
):
(function () {
angular.module('kioskApp', ['ngRoute'])
.config(function ($routeProvider) {
$routeProvider.when("/", {
controller: "homeController",
controllerAs: "vm",
templateUrl: "../../app/home/home.html"
});
$routeProvider.when("/login", {
controller: "loginController",
controllerAs: "vm",
templateUrl: "../../app/login/login.html"
});
$routeProvider.when("/login/create", { // <--- can't go there?
controller: "createUserController",
controllerAs: "vm",
templateUrl: "../../app/login/create.html"
});
$routeProvider.otherwise({ redirectTo: "/" });
});
})();
我完全可以转到/login
,但出于某种原因,我无法使用/login/create
中的锚点/login.html
:
<a href="#!/login/create/" class="btn btn-danger"
ng-show="!vm.listIsSet" style="float:right;">Create New</a>