3

角度: 1.1.5

私はに行きます: HTML5モードをオフにして正常に動作するhttp://xxxxx.com/route1/route2/route3 代わり/route3にトリガーされます... :(route1/route2/route3

Nginxの設定

location / {
    index index.html;
    try_files $uri $uri/ /index.html?$args;
}

私のアプリ構成

$routeProvider.when('/route1/route2/route3', {
        templateUrl: '/views/home.html',
        controller: 'HomeCtrl'
    });

$routeProvider.when('/route3', {
        templateUrl: '/views/home.html',
        controller: 'HomeCtrl'
    });

$locationProvider.hashPrefix('!');
$locationProvider.html5Mode(true);

$locationログ:

$$protocol: "http", $$host: "xxxxxx"…}
$$absUrl: "http://xxxxxxx.com/route1/route2/route3"
$$hash: ""
$$host: "10.44.11.73"
$$path: "/route3"
$$port: 80
$$protocol: "http"
$$replace: false
$$url: "/route3"

ネストされたルートで HTML5 URL が機能するように設定を変更するにはどうすればよいですか?

4

2 に答える 2

3

追加

<base href="/">

あなたにindex.html

于 2014-06-25T00:06:50.493 に答える