Last active
October 4, 2017 07:16
-
-
Save kobvel/b31db426f2c5e9c77cbb35aeeb45d93d to your computer and use it in GitHub Desktop.
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 { OnInit, OnDestroy } from '@angular/core'; | |
import { Subscription } from 'rxjs/Rx'; | |
import { ApiService } from '../../shared/api.service'; | |
@Component() | |
export class ProfileComponent implements OnInit, OnDestroy { | |
public profileData$: Subscription; | |
public data; | |
constructor(private apiService: ApiService) {} | |
ngOnInit() { | |
this.profileData$ = this.apiService.getProfileData() | |
.subscribe(data => this.data = data); | |
} | |
ngOnDestroy() { | |
this.profileData$.unsubscribe(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment