2016-04-09 113 views
0

我想知道有人可以幫助我與我的Angular項目。 我希望能夠使用路由。問題是我創建的所有鏈接都指向localhost/something。即使我將base標籤放在index.html中,它也不起作用。角路由斷開鏈接

的basetag看起來是這樣的:
<base href="/routing/"></base>

的app.js看起來是這樣的:
$routeProvider. when('/', { templateUrl: 'partials/home.html' }). when('/next', { templateUrl: 'partials/next.html' }). otherwise({ redirectTo: '/' }); $locationProvider.html5Mode({ enabled: true, requireBase: false });

與家用模板看起來是這樣的:
<h1>Home Template</h1> <a href="/next">Next</a>

鏈接時我將鼠標懸停在錨標記上: enter image description here

我該如何解決這個問題?

+0

Finaly發現在鏈接應該是這樣的:Next user3519221

回答

0

<a href="/routing/next">Next</a>

這是你希望達到什麼樣的?

+0

是的,但它是但我認爲必須有一個更好/更乾淨的方式來做到這一點。 – user3519221