Created
August 26, 2017 13:06
-
-
Save ajspeller/a8355e51c7f2e2c791bc09cf357bdba1 to your computer and use it in GitHub Desktop.
Prevent memory leaves with Observables
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
private subscription; | |
cuisines; | |
constructor(private _af: AngularFire) {} | |
ngOnit() { | |
this.subscription = this._af | |
.database.list('cuisines') | |
.subscribe( () => { | |
this.cuisines = x; | |
console.log(this.cuisines); | |
}); | |
} | |
ngOnDestroy() { | |
this.subscription.unsubscribe(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment