1

使用 angularjs 时,#需要删除 。为此,您需要设置以下内容:

$locationProvider.html5Mode(true);

并添加基本标签,以便在页面刷新时正常工作。关键是如果它被定义为<base href="http://example.com/">then 它只能从这个 url 工作。即我无法访问该网站www.example.com

那么有没有办法配置某种多基,以便当一个失败时,它会被另一个替换?

4

2 回答 2

2

<base href="/"></base>- 对于网络应用程序ROOT

<base href="/webappName/"></base>- 对于非网络应用程序ROOT

<base>此外,如果您有相对标签,则只需要使用该<a>标签。

于 2016-03-31T13:09:24.193 回答
1

您可以使用:

<base href="/">

或者,如果您不想使用 base:

$locationProvider.html5Mode({ enabled: true, requireBase: false });

于 2016-03-31T13:11:04.063 回答