Skip to content

Instantly share code, notes, and snippets.

@YonathanMeguira
Created August 7, 2017 00:05
Show Gist options
  • Save YonathanMeguira/c042d6ed39122a9b15705070e7258b06 to your computer and use it in GitHub Desktop.
Save YonathanMeguira/c042d6ed39122a9b15705070e7258b06 to your computer and use it in GitHub Desktop.
retrievingMonsters
import {Component, OnInit} from '@angular/core';
import {Monsters} from './monsters';
@Component({
selector: 'monsters',
templateUrl: './monsters.component.html',
styleUrls: ['./monsters.component.css']
})
export class MonstersComponent implements OnInit {
currentSelectedMonster: string;
constructor(private monsterService: Monsters){}
ngOnInit(){
this.monsterService.monsters.subscribe(
monster => this.currentSelectedMonster = monster
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment