Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ionViewDidLoad() {
- this.searchInput.valueChanges
- .filter((term) => {
- this.showSpinner = true
- this.isError = false;
- if (term) {
- return term
- } else {
- this.listing = [];
- this.showSpinner = false;
- }
- })
- .debounceTime(500)
- .distinctUntilChanged()
- .subscribe(
- term => this.spotify.load(term)
- .subscribe(
- results => this.listing = results.tracks.items,
- err => console.log(err),
- () => {
- this.showSpinner = false
- })
- )
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement