rungwiroon / BlazorGoogleMaps

Blazor interop for GoogleMap library
MIT License
339 stars 105 forks source link

Autocomplete in Client Side Blazor WebAsembly #236

Closed micswe closed 1 year ago

micswe commented 1 year ago

I try Autocomplete in Webasembly. I use the same code as in Server Side demopage.

The error come on execute this dunction.

this.autocomplete = await Autocomplete.CreateAsync(this.map1.JsRuntime, this.searchBox, new AutocompleteOptions { StrictBounds = false, //ComponentRestrictions = new ComponentRestrictions { Country = new[] { "us" } } });

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Cannot read properties of undefined (reading 'Autocomplete') TypeError: Cannot read properties of undefined (reading 'Autocomplete') at stringToFunction (https://localhost:7217/_content/BlazorGoogleMaps/js/objectManager.js:7:20) at Object.createObject (https://localhost:7217/_content/BlazorGoogleMaps/js/objectManager.js:337:35) at https://localhost:7217/_framework/blazor.webassembly.js:1:3332 at new Promise () at Object.beginInvokeJSFromDotNet (https://localhost:7217/_framework/blazor.webassembly.js:1:3306) at Object.St [as invokeJSFromDotNet] (https://localhost:7217/_framework/blazor.webassembly.js:1:59938) at _mono_wasm_invoke_js_blazor (https://localhost:7217/_framework/dotnet.6.0.13.mz549ijgd6.js:1:195300) at wasm://wasm/00971d3e:wasm-function[219]:0x1a492 at wasm://wasm/00971d3e:wasm-function[167]:0xce60 at wasm://wasm/00971d3e:wasm-function[166]:0xbd73 Microsoft.JSInterop.JSException: Cannot read properties of undefined (reading 'Autocomplete') TypeError: Cannot read properties of undefined (reading 'Autocomplete') at stringToFunction (https://localhost:7217/_content/BlazorGoogleMaps/js/objectManager.js:7:20) at Object.createObject (https://localhost:7217/_content/BlazorGoogleMaps/js/objectManager.js:337:35) at https://localhost:7217/_framework/blazor.webassembly.js:1:3332 at new Promise () at Object.beginInvokeJSFromDotNet (https://localhost:7217/_framework/blazor.webassembly.js:1:3306) at Object.St [as invokeJSFromDotNet] (https://localhost:7217/_framework/blazor.webassembly.js:1:59938) at _mono_wasm_invoke_js_blazor (https://localhost:7217/_framework/dotnet.6.0.13.mz549ijgd6.js:1:195300) at wasm://wasm/00971d3e:wasm-function[219]:0x1a492 at wasm://wasm/00971d3e:wasm-function[167]:0xce60 at wasm://wasm/00971d3e:wasm-function[166]:0xbd73 at Microsoft.JSInterop.JSRuntime.d16`1[[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() at GoogleMapsComponents.Helper.d4`1[[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() at GoogleMapsComponents.JsObjectRef.CreateAsync(IJSRuntime jsRuntime, Guid guid, String functionName, Object[] args) at GoogleMapsComponents.Maps.Places.Autocomplete.CreateAsync(IJSRuntime jsRuntime, ElementReference inputField, AutocompleteOptions opts) at WorkTimeApp.Area.Pages.GeoLocation.SetupGoogleAddressAutoComplete() in C:\Users\mschwenke.TEAM-NETZ\source\repos\WorkTime\WorkTimeApp\Area\Pages\GeoLocation.razor:line 126 at WorkTimeApp.Area.Pages.GeoLocation.OnClickSearch() in C:\Users\mschwenke.TEAM-NETZ\source\repos\WorkTime\WorkTimeApp\Area\Pages\GeoLocation.razor:line 142 at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) <<

valentasm1 commented 1 year ago

Could you show which libraries you included? I have feeling you missing smth.

micswe commented 1 year ago

Sorry, what is smth ? i dont have this libary in my project

valentasm1 commented 1 year ago

How yours look?

micswe commented 1 year ago

Thats the Problem, i miss the "," places and virtualization.

Thank you