title: Angular 6 - Cannot read property 'outlets' of null
body: <p>I am working on <strong>angular 6</strong>, when I add a router link without any condition (<code>*ngIf</code>) the router link throws "<code>Cannot read property 'outlets' of null</code>" but when I add a condition within the particular section it won't throw any error link that. </p>
  
  <p>Example : </p>
  
  <pre><code>&lt;section&gt;
  &lt;a [routerLink]="['/user',x?.username]"&gt; {{x?.username}} &lt;/a&gt;
  &lt;/section&gt;
  </code></pre>
  
  <p>the above code throws an error. (Cannot read property 'outlets' of null)
  but </p>
  
  <pre><code>&lt;section *ngIf="x?.username != null"&gt;
  &lt;a [routerLink]="['/user',x?.username]"&gt; {{x?.username}} &lt;/a&gt;
  &lt;/section&gt;
  </code></pre>
  
  <p>this one won't throw any error. </p>
  
  <p>Could any one guide me on this? </p>
  
  <p>Thanks in advance.</p>