Advantage to use Route instead *ngIf to control Angular View Component? Advantage to use Route instead *ngIf to control Angular View Component? dart dart

Advantage to use Route instead *ngIf to control Angular View Component?


The main advantage is that the browser URL bar reflects the state.

When the user creates a bookmark and comes back, she will get the same view, while with *ngIf, the initial view will always be the same.

A disadvantage using the router is, that no bindings like <my-component [foo]="xxx" (bar)="doSomething()" are not possible with components added by the router. For this kind of communication usually a shared service is used.