title: Angular - generate routerLink with secondary route
body: <p>With Angular 8, I created a "login callback" page that should redirect (by link, or automatically) to the previous page. But previous page can contains some secondary routes.</p>
  
  <p>So, to avoid "full reload" of the page on navigation, I tried to use [routerLink] in the template to build the "go to previous page" button, and "this.router.navigate(...)" inside the controller if I want to redirect programmatically.</p>
  
  <p>The problem is :
  It seems that Angular cannot serialize correctly the secondary route (with parenthesis)</p>
  
  <p>Example :</p>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>constructor(private router: Router){}
  
  public redirectRoute: string;
  
  onInit() {
    this.redirectRoute = '/home(modal:modal/secondary);param1=value1';
  }
  </code></pre>
  
  <p><strong>Template:</strong></p>
  
  <pre><code>&lt;a [routerLink]="redirectRoute"&gt;Go to previous page&lt;/a&gt;
  </code></pre>
  
  <p>The URL built serialize parenthesis, <strong>(</strong> becomes <strong>%28</strong>, and <strong>)</strong> becomes <strong>%29</strong>. So navigation fails, route isn't recognize and it fallback on default route.</p>
  
  <p>In fact, "redirectRoute" is dynamic, so I don't look for an answer like "build redirectRoute in the template directly". Of course it works, but I can't.</p>
  
  <p>I tried many things ; I can parse the URL (with <code>this.router.parseUrl(rawRedirectUrl);</code>), it returns a good URLTree (secondary route is well formed), but I don't find how to use an URLTree into [routerLink] tag.</p>
  
  <p>Same thing occured if I want to redirect with <code>this.router.navigate(this.redirectRoute)</code>...</p>
  
  <p>How to redirect properly without reloading all the page ?</p>
  
  <p>Thanks !</p>
  
  <p><strong>[EDIT]</strong></p>
  
  <p>I opened <a href="https://github.com/angular/angular/issues/35414" rel="nofollow noreferrer">https://github.com/angular/angular/issues/35414</a></p>