1

I am using Angular 5 CLI and have a service which retrieves HTML markup data from a document database and renders it on the page using the [innerHTML] binding and it works great. However, there are links on the page which I want to associate with the route using a routerLink binding but the problem is that the innerHTML is loaded after the lifecycle events have fired, I think, but I am too new to Angular to know if what I am saying is correct. I was thinking that an anchor tag in my HTML data could point to a relative url such as ../myotherview and have the Angular router understand the path dynamically.

Should I consider running some logic AFTER the innerHTML is appended to the DOM, searching for all tags and converting them to routerLink attributes?

Appreciate any and all help you can provide as I am a bit lost as to how to have dynamic routing assignments from HTML data returned from a CMS.

0 Answers0