Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. ionViewDidLoad() {
  2. this.searchInput.valueChanges
  3. .filter((term) => {
  4. this.showSpinner = true
  5. this.isError = false;
  6. if (term) {
  7. return term
  8. } else {
  9. this.listing = [];
  10. this.showSpinner = false;
  11. }
  12. })
  13. .debounceTime(500)
  14. .distinctUntilChanged()
  15. .subscribe(
  16. term => this.spotify.load(term)
  17. .subscribe(
  18. results => this.listing = results.tracks.items,
  19. err => console.log(err),
  20. () => {
  21. this.showSpinner = false
  22. })
  23. )
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement