A few examples show how to use observable elements to connect a control to display data received from the http backend, for example: http://blog.thoughtram.io/angular/2016/01/06/taking-advantage-of-observables- in-angular2.html
Can you prevent this HTTP call in certain situations? For example, in the mentioned record there is an autocomplete field - is there a way to prevent the http call if the user clears the field?
I tried to change the switchMap function, for example:
if(term.length < 1) {
return Observable.empty();
}
else {
and this prevents the call, but leaves the previous results in the control.
source
share