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

10,697

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

Share:
10,697
Admin
Author by

Admin

Updated on July 10, 2022

Comments

  • Admin
    Admin almost 2 years

    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)