Guest User

Untitled

a guest
Dec 13th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. export class Component {
  2.  
  3. mounted = true;
  4. constructor(private s: MyService){}
  5.  
  6. onMount(){
  7.  
  8. this.s.obs.takeWhile(makePredicate()).subscribe(...)
  9.  
  10. }
  11.  
  12. makePredicate(){
  13. return () => this.mounted;
  14. }
  15.  
  16. onDismount(){
  17. this.mounted = false;
  18. }
  19.  
  20.  
  21. }
Add Comment
Please, Sign In to add comment