Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to solve error "[$location:nobase] $location in HTML5 mode requires a <base> tag to be present!"

I have no idea how to solve this case.

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)

like image 679
Aye Thwin Avatar asked Oct 19 '16 03:10

Aye Thwin


1 Answers

This happens when you have set html5mode, like so :

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

Just add a tag in your HTML template like so :

<head>
 <base href="/">
 ...
</head>

It's exactly same thing mentioned in the docs here: https://docs.angularjs.org/error/$location/nobase

like image 156
nikjohn Avatar answered Nov 15 '22 06:11

nikjohn