Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49210

Rx/js help

$
0
0

@Justin_H wrote:

Can someone please take a look at this and explain to me why the code works with the timeout observable return value and not the observal.of return value in the getCourses method.

https://plnkr.co/edit/91HdBT?p=preview
In this plnkr if you type something into the search box nothing happens but if you use the timeout return value and wait 5s it does work : /

 this.filteredCourses = <any>this.search.ionInput
        .debounceTime(400)
        .distinctUntilChanged()
        .flatMap((term:any) => Observable.of([{id:'abc'},{id:'bca'},{id:'cab'}]))//this.cSrv.searchCourses(term.target.value));
  getCourses(){
    //return Observable.timer(5000,0).first().map(v=>[{id:'abc'},{id:'bca'},{id:'cab'}]); //-- this works!
    return Observable.of([{id:'abc'},{id:'bca'},{id:'cab'}]);  //-- this doesn't!
  }

Thanks

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49210

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>