I'm trying to use blazored typeahed for my app but there seems to be a problem with the search method.
Here is my current code:
<BlazoredTypeaheadInput SearchMethod="Search"
@bind-Value="Value"
Placeholder="@Resources.SelectVehicle.SearchByLicensePlateNumber"
MinimumLength="3"
Debounce="500">
</BlazoredTypeaheadInput>
@code {
private Vehicle _value;
private async Task<List<Vehicle>> Search(string searchText)
{
var request = new SERVICES.FindVehiclesRequest()
{
LicensePlateNumber = searchText,
};
string[] ids = await VehicleService.FindVehicles(request);
SERVICES.VehicleItem[] vehicles = await VehicleService.GetVehicles(ids.Take(5));
List<Vehicle> result = vehicles
.Select(Convert)
.ToList();
return await Task.FromResult(result);
}
Apparently, there's a mistake in the Search method as I get this error - 'Task> __generated__SelectVehicle.Search(string)' has the wrong return type'
I've tried to return just return result;
but it didn't help.
The SearchMethod
Parameter on this component expects a return type of IEnumerable<T>
inside a Task, so your method signature needs to be
private async Task<IEnumerable<Vehicle>> Search(string searchText)