Created
July 27, 2017 15:27
-
-
Save chrillewoodz/e41eec55ecb7767d72af73309d482f35 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ModalApi { | |
private states = new BehaviorSubject<any>(true); | |
public states$ = this.states.asObservable(); | |
constructor() {} | |
open(id: string, template?: string): Promise<any> { | |
this.states.next({isOpen: true, id: id, template: template}); | |
return new Promise((resolve, reject) => { | |
resolve({id: id, template: template}); | |
}); | |
} | |
close(id: string): Promise<any> { | |
this.states.next({isOpen: false, id: id}); | |
return new Promise((resolve, reject) => { | |
resolve({id: id}); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment