Angular: Cannot read property 'component' of null
Ok. I managed to fix this. I do not fully understand but here is what I found:
The
Cannot read property 'component' of null
disapear when therouter-outlet
is included only once in the app HTML (e.g: contrary to the inclusion ofrouter-outlet
in each of multiple branches of theng-if
condition)When I change the conditional inclusion of
router-outlet
from
this form:
<div *nfIf="condition">
<router-outlet></router-outlet>
</div>
<div *nfIf="!condition">
<router-outlet></router-outlet>
</div>
to this form:
<div *nfIf="condition;else notcondition">
<router-outlet></router-outlet>
</div>
<ng-template #notcondition>
<router-outlet></router-outlet>
</ng-template>
I have no issue navigating from login page to login page with parameters.