我不知道如何解决这种情况。
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/