1

HTML text was stored in database. Text contains anchor links like

<a href="#id">click</a>
---------
---------
<h1 id="id">sample </h1>

We are retriving this html content from database to render in angular 6+ page. Content rendered fine but if we click anchor it navigated to 'http://localhost:3000/#id' in browser and displays error page since its not available in routing.

How can we restrict default routing and how to make internal anchor linking work in this type of scenario without modifying html content in database.

Is there any possibility in angular 6+ ?

R. Richards
  • 24,603
  • 10
  • 64
  • 64
  • 1
    It can be helpful for you. https://stackoverflow.com/questions/50836497/using-html-anchor-link-id-in-angular-6 – Akib Jul 07 '22 at 08:08
  • Thank you @Akib but we don't want to change any html attributes. Content is plain html in DB. We need to render the content in angular page without changing content. So anchors should be in html format. – Phanindra Kumar Pedipini Jul 07 '22 at 10:27

0 Answers0