Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Angular Template Angular Template
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 1
    • Issues 1
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • IzeniIzeni
  • Angular TemplateAngular Template
  • Wiki
  • gotchas

gotchas · Changes

Page history
Add router gotcha authored May 05, 2017 by Ryan Berger's avatar Ryan Berger
Show whitespace changes
Inline Side-by-side
gotchas.md
View page @ 62c76c99
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]);
}
```
Clone repository
  • angular
  • cookbook forms
  • cookbook routing
  • data store
  • gotchas
  • Home
  • modals
  • sass with bem
  • toolbox
  • typescript
  • webpack