Not working with async results
See original GitHub issueHi there,
I’m using Ionic 3.4.2, and with async results, it doesn’t seems to work:
Here’s my service:
import { CompanyService } from './company.service';
import { AutoCompleteService } from 'ionic2-auto-complete';
import { Injectable } from "@angular/core";
import * as _ from 'lodash';
@Injectable()
export class CompanyCompleteService implements AutoCompleteService {
labelAttribute = "name";
constructor(
private companyService: CompanyService
) {
}
public async getResults(keyword: string) {
let jobs = await this.companyService.listJobs();
let results = _.filter(jobs, j => {
return j.name.toLowerCase().startsWith(keyword.toLowerCase())
});
console.log('results', results);
return results;
}
}
I have results logged in results
:
Any ideas?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Why doesn't my async function return any result?
If async-await does not work for some reason, use then clause: warte(aufgabe).then(value => { var ergebnis = value; });.
Read more >Asynchronous programming: futures, async, await | Dart
To interact with these asynchronous results, you can use the async and await keywords. ... This example shows how *not* to write asynchronous...
Read more >Use Promise.all to Stop Async/Await from Blocking Execution ...
In async functions, await blocks any code that follows from executing until the Promise has resolves, which means that our refactored code doesn't...
Read more >Asynchronous programming in C# | Microsoft Learn
Cooking breakfast is a good example of asynchronous work that isn't parallel. One person (or thread) can handle all these tasks.
Read more >await - JavaScript - MDN Web Docs
It can only be used inside an async function or at the top level of a module. ... all while not blocking other...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I found a way to let it work with async function 😃
But async function should be handled by default! 👍
No problem! If I have some time I can try to fix this. Shouldn’t be that hard.