2016-04-09 222 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