title: Angular 7: add routing links from backend
body: <p>I'm trying to find a way to add route link to data retreived from backend API.
  I tried to add <code>&lt;a routerLink="..."&gt;...&lt;/a&gt;</code> in the backend data then to use <code>bypassSecurityTrustHtml()</code> but it is not working.</p>
  
  <p>I wonder if I have to use .html sub template or if I can manage it fully from TypeScript?</p>
  
  <p>EDIT 1:
  Here is the data I receive from the back:</p>
  
  <pre><code>{
     "status":"OK",
     "result":{
        "chmn":[
           {
              "id":267,
              "number":"",
              "hanzi":"\u4e00",
              "simplified":"",
              "mnemonics":"one; &lt;a&gt;\u58f1&lt;\/a&gt; &lt;a&gt;\u7532&lt;\/a&gt;; &lt;a&gt;\u4f96&lt;\/a&gt; &lt;a&gt;\u4fde&lt;\/a&gt; &lt;a&gt;\ud842\udf9b&lt;\/a&gt; &lt;a&gt;\u4ee4&lt;\/a&gt; &lt;a&gt;\u5f10&lt;\/a&gt; &lt;a&gt;\u6b66&lt;\/a&gt; &lt;a&gt;\u6238&lt;\/a&gt; &lt;a&gt;\u81f3&lt;\/a&gt; &lt;a&gt;\u767e&lt;\/a&gt;;",
              "alike":"",
              "mine":false,
              "meaning":"",
              "reference":"",
              "remnant":false
           }
        ]
     }
  }
  </code></pre>
  
  <p>What I'm trying to acheive is to replace empty <code>&lt;a&gt;\u58f1&lt;\/a&gt;</code> by <code>&lt;a routerLink="/details/\u58f1"&gt;\u58f1&lt;/a&gt;</code> to create a dynamic route link.
  But if I directly put this in the backend response, Angular will not consider it as a real router link.</p>
  
  <p>EDIT 2: Thanks to Stefan, here is the solution I've used:</p>
  
  <pre><code>  res.result.chmn.forEach(element =&gt; {
      element.mnemonics = element.mnemonics.split(/(\p{Script=Hani})+/gu);
    });
  </code></pre>
  
  <p>and in the template:</p>
  
  <pre><code>&lt;span *ngFor="let mnemonic of kanji.mnemonics"&gt;
      &lt;span *ngIf="mnemonic.length &gt; 1" [innerHTML]="mnemonic | sanitizeHtml"&gt;&lt;/span&gt;
      &lt;a *ngIf="mnemonic.length == 1" routerLink="/details/{{mnemonic}}"&gt;{{mnemonic}}&lt;/a&gt;
  &lt;/span&gt;
  </code></pre>