Closed ask007learning closed 7 years ago
The issue is your use of map
here:
this.autoCompleteList = this.searchCtrl.valueChanges
.startWith(null)
.map(txt => this.filterSearchResults(txt))
Instead, you should be using switchMap
.
To get your plunker to work, you'll need to make the switchMap
change as well as these:
import 'rxjs/add/observable/from';
...
filterSearchResults(val: string){
return val ? this.getResults(): Observable.from([]);
}
Thanks for looking into it, @willshowell! It does look like switchMap
would be more appropriate here. ngFor
+ the async pipe expects the bound observable to emit iterables, not nested observables. Closing, as it works as intended.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
Bug, feature request, or proposal:
Bug
What is the expected behavior?
To handle observable
What is the current behavior?
Throws the following error: Cannot find a differ supporting object '[object Object]' of type 'object'
What are the steps to reproduce?
https://plnkr.co/edit/YQ5dLMXChxnLM7bRWMl7?p=preview
Which versions of Angular, Material, OS, browsers are affected?
material: 2.0.0-beta.2