|
|
COMING SOON |
|
|
\ No newline at end of file |
|
|
[routerLink] doesn't have ANY change detection. This means that if a value comes in slower than when it gets instantiated by Angular, then it won't work, below I have two solutions
|
|
|
|
|
|
Example Problem:
|
|
|
```html
|
|
|
<a [routerLink]="['/some-route', valueThatIsTooSlowThatWillBeNullOrUndefined]">
|
|
|
|
|
|
```
|
|
|
|
|
|
Solution 1:
|
|
|
|
|
|
```html
|
|
|
<a *ngIf="value" [routerLink]="['/some-route', value]"/>
|
|
|
```
|
|
|
|
|
|
Solution 2:
|
|
|
```html
|
|
|
<a (click)=navigateToRoute(value.id)/>
|
|
|
```
|
|
|
|
|
|
```typescript
|
|
|
public navigateToRoute(id: number) {
|
|
|
this.router.navigate(['/some-route', id]);
|
|
|
}
|
|
|
|
|
|
``` |