无法访问"孩子"使用ngRoute的路线页面

时间:2017-05-16 12:38:08

标签: javascript html angularjs ngroute

我似乎无法让我的路由(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>

enter image description here

0 个答案:

没有答案