title: Angular routerLink within [innerHTML]
body: <p>I have been looking around for a way to enable standard a[href] links to act like routerLinks when loaded dynamically into [innerHTML]. It doesn't seem to be something that works as standard and I couldn't find anything that did what I needed.</p>
  
  <p>I have a working solution but wondered if anybody knows of any better ways to do this or any potential issues I might run into doing it this way.</p>
  
  <p>I am using jQuery from inside my app-routing.module.ts so I declare the variable:</p>
  
  <pre><code>declare var $:any;
  </code></pre>
  
  <p>I then find all anchors with the href attribute that do not also have the routerlink attribute. I can then grab the pathname and tell the router to navigate to it on click.</p>
  
  <pre><code>$(document).on('click', `a[href]:not("a[routerlink]"):not("a[href^='mailto:']"):not("a[href^='tel:']")`, function(e){
      if(location.hostname === this.hostname || !this.hostname.length){
          e.preventDefault();
          router.navigate([this.pathname]);
      }
  });
  </code></pre>
  
  <p>This seems to do the job but I thought there must be a more 'Angular' way of doing this...</p>