gpt4 book ai didi

angularjs - 如何解决错误 “[$location:nobase] $location in HTML5 mode requires a tag to be present!”

转载 作者:行者123 更新时间:2023-12-04 10:47:38 29 4
gpt4 key购买 nike

我不知道如何解决这种情况。

Error: [$location:nobase] $location in HTML5 mode requires a tag to be present! http://errors.angularjs.org/1.5.7/$location/nobase at angular.js:68 at $LocationProvider.$get (angular.js:13384) at Object.invoke (angular.js:4709) at angular.js:4508 at getService (angular.js:4655) at injectionArgs (angular.js:4679) at Object.invoke (angular.js:4701) at angular.js:4508 at getService (angular.js:4655) at injectionArgs (angular.js:4679)

最佳答案

当您设置了html5mode时,就会发生这种情况,如下所示:

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

只需在HTML模板中添加一个标签,如下所示:
<head>
<base href="/">
...
</head>

此处的文档中提到的内容完全相同: https://docs.angularjs.org/error/ $ location/nobase

关于angularjs - 如何解决错误 “[$location:nobase] $location in HTML5 mode requires a <base> tag to be present!”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40121747/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com