Created
May 10, 2018 09:10
-
-
Save SaurabhLpRocks/b627b6d6972c31d6733a7d697e3e39b8 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 {HttpClient} from '@angular/common/http'; | |
| import {Observable} from 'rxjs'; | |
| import {share} from 'rxjs/operators'; | |
| @Injectable() | |
| export class AppService { | |
| data: Observable < any >; | |
| constructor(private http : HttpClient) { | |
| this.data = this.http.get<any> ('apiUrl').pipe(share()); | |
| } | |
| getData() { | |
| return this.data; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment