You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Could you add an example in the docs how we can use Typahead with locally stored values in (an array) and async data together?
Sometimes request haven't been saved on the server (yet) but have been used locally, so I want to store those locally.. so Typeahead can use them... but merge these local results with the server results. Since RxJS isn't that friendly for beginners, I really need an example.
Thanks
The text was updated successfully, but these errors were encountered:
I've got this working, and would like to share my code
ngOnInit() {
this.dataSource = Observable.create((observer: any) => {
let search: string = this.controlContainer.control.get('name').value;
let remote = this.someService.search(search);
let query = new RegExp(search, 'ig');
let locale = Observable.of(this.someService.localValues.filter(x => query.test(x.name)));
Observable
.forkJoin([remote, locale], (remote, locale) =>{
return remote.concat(locale);
})
.subscribe(results => {
observer.next(results);
});
});
}
I also store local values with a subscription on the Typeahead field.. if everything is valid.. i clear the old values from the service (if they match) and push new value.
Hi,
[x] doc addition
Could you add an example in the docs how we can use Typahead with locally stored values in (an array) and async data together?
Sometimes request haven't been saved on the server (yet) but have been used locally, so I want to store those locally.. so Typeahead can use them... but merge these local results with the server results. Since RxJS isn't that friendly for beginners, I really need an example.
Thanks
The text was updated successfully, but these errors were encountered: