Last active
August 6, 2017 23:54
-
-
Save YonathanMeguira/23fd7f42a9cf9e9c5e0a7a4de10720ab to your computer and use it in GitHub Desktop.
dataService.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Injectable} from '@angular/core'; | |
import {BehaviorSubject} from 'rxjs/BehaviorSubject'; | |
@Injectable() | |
export class Monsters{ | |
private _monter: SubjectBehavior<string[]>; | |
constructor(){ | |
// passing it an empty monster for starter | |
this._monster = new BehaviorSubject(''); | |
} | |
selectMonster(newMonster: string){ | |
this._monster.next(newMonster); | |
} | |
get monster(){ | |
return this._monster.asObservable(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment