Menu Close

How to fix no base href set error with Angular router?

Sometimes, we want to fix no base href set error with Angular router.

In this article, we’ll look at how to fix no base href set error with Angular router.

How to fix no base href set error with Angular router?

To fix no base href set error with Angular router, we add the base element into the index.html file.

For instance, we write

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

to add the <base href="/" /> into the head element in index.html to clear the error.

Conclusion

To fix no base href set error with Angular router, we add the base element into the index.html file.

Posted in Angular, Angular Answers