Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hero details, routes, params #13

Merged
merged 4 commits into from
Jun 16, 2018
Merged

Add hero details, routes, params #13

merged 4 commits into from
Jun 16, 2018

Conversation

brunolm
Copy link
Owner

@brunolm brunolm commented Jun 16, 2018

npx ng g c heroes/hero-details

to pass parameters to the router link

[routerLink]="[ '/heroes', hero.id ]"

to add a class if the route is active

routerLinkActive="active"

to get values from params

this.route.paramMap.pipe(map((params) => +params.get('id'))).subscribe((id) => {
  this.activeHero = this.heroes.find((hero) => hero.id === id);
});

Added the package ngx-take-until-destroy to unsubscribe observables.
https://github.com/NetanelBasal/ngx-take-until-destroy

@coveralls
Copy link

Coverage Status

Coverage increased (+1.6%) to 90.066% when pulling 9c0e7dc on feature/hero-details into 0684e5f on master.

@brunolm brunolm merged commit 4ada823 into master Jun 16, 2018
@brunolm brunolm deleted the feature/hero-details branch June 16, 2018 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants