Skip to content

Instantly share code, notes, and snippets.

@i-oliva
Created June 6, 2018 14:57
Show Gist options
  • Save i-oliva/9bb894bd5f52cae36cc0801ce227cd94 to your computer and use it in GitHub Desktop.
Save i-oliva/9bb894bd5f52cae36cc0801ce227cd94 to your computer and use it in GitHub Desktop.
import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { HeroesService } from '../services/heroes.service';
@Component({
selector: 'app-heroe',
templateUrl: './heroe.component.html'
})
export class HeroeComponent {
heroe: any = {
};
constructor(private _activatedRoute: ActivatedRoute, private _heroesService: HeroesService) {
this._activatedRoute.params.subscribe(params => {
this.heroe = this._heroesService.getHeroe(params['id']);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment