Angular ui-路由器:链接不可点击

Angular ui-router : Links are not clickable

我尝试 运行 angular-ui-router 来处理我的观点,但我遇到了问题。 以下视图的两个 link 是不可点击的。 Angular 使用 link 标签更改变量,但我无法点击。

我有这样的看法:

<!DOCTYPE html>
<html ng-app="MyApp">
    <head>
            <meta charset="utf-8">
    </head>
    <body>
        <h1>App</h1>
        <nav>
            <a ui-shref="app">{{link.home}}</a>
            <a ui-shref="app.front.signin">{{link.signin}}</a>
        </nav>
         <div ui-view="content">
        </div>
    </body>
</html>    

我用这个代码。它不会 returns 错误 .所有模块(包含 localStorage ...)但 link 不可点击。

/**
 * Declaration of MyAppControllers module
 */
 MyAppControllers = angular.module('MyAppControllers',[]);
/**
 * Declaration of MyApp Application
 */
MyApp = angular.module('MyApp', ['MyAppControllers','LocalStorageModule','ui.router']);  


MyApp.config(['$stateProvider', '$urlRouterProvider',
function ($stateProvider, $urlRouterProvider) {
    $urlRouterProvider.otherwise("/");
    //
    // Now set up the states
    $stateProvider
            .state('app', {
                url: "/",
                views: {
                    "content": {templateUrl: "views/front/home-1.0.html"}
                }
            }) 
            .state('app.front.signin', {
                url: "/signin",
                views: {
                    "content": {templateUrl: "views/front/home-1.0.html", controller: "signinCtrl"}
                }
            });

    }
]);

有人可以帮助我吗?

你写错了,应该是 ui-sref 而不是 ui-shref

<body>
    <h1>App</h1>
    <nav>
        <a ui-sref="app">{{link.home}}</a>
        <a ui-sref="app.front.signin">{{link.signin}}</a>
    </nav>
     <div ui-view="content">
    </div>
</body>

你的第二个 link 应该是 app.signin 而不是 app.front.signin 因为你没有父路由 front

.state('app.signin', {
    url: "/signin",
    views: {
        "content": {
            templateUrl: "views/front/home-1.0.html", 
            controller: "signinCtrl"
        }
    }
});