rungwiroon / BlazorGoogleMaps

Blazor interop for GoogleMap library
MIT License
309 stars 99 forks source link

Property 'marker' not found Error #343

Closed vinco83 closed 2 weeks ago

vinco83 commented 2 weeks ago

I'm receiving an exception in objectManager, stringToFunction when attempting to create a new AdvancedMarkerElement:

Property 'marker' not found Error: Property 'marker' not found at stringToFunction (https://localhost:44392/_content/BlazorGoogleMaps/js/objectManager.js:8:23) at Object.createObject (https://localhost:44392/_content/BlazorGoogleMaps/js/objectManager.js:324:35) at https://localhost:44392/_framework/blazor.web.js:1:3244 at new Promise () at y.beginInvokeJSFromDotNet (https://localhost:44392/_framework/blazor.web.js:1:3201) at gn._invokeClientMethod (https://localhost:44392/_framework/blazor.web.js:1:62841) at gn._processIncomingData (https://localhost:44392/_framework/blazor.web.js:1:60316) at connection.onreceive (https://localhost:44392/_framework/blazor.web.js:1:53957) at i.onmessage (https://localhost:44392/_framework/blazor.web.js:1:82102)

My code to create the element is as follows:


        var marker = await AdvancedMarkerElement.CreateAsync(_jsRuntime, new AdvancedMarkerElementOptions
{
    Position = coords,
    Content = ""
});
valentasm1 commented 2 weeks ago

I dont get this error with your code. I think you missing Map and content should be "" What are you trying to archive?

vinco83 commented 2 weeks ago

I apologize for the lack of info--been debugging this for hours now. I've copied over the example from here: https://github.com/rungwiroon/BlazorGoogleMaps/blob/master/ServerSideDemo/Pages/MapAdvancedMarkerViewPage.razor#L28

So that my code now looks like this:

image

image

But when it attemps to create the marker, it throws the exception mentioned in my initial post:

image

I've tried clearing cache, clearing nuget references, re-installing nuget, etc etc...can't seem to figure this one out

valentasm1 commented 2 weeks ago

Is it server side or client side? Ar you able run sample? Please next time paste code not screenshots.

vinco83 commented 2 weeks ago

I managed to figure this issue out (finally). Seems another dev changed how we're loading the google map javascript. I had to add "&libraries=marker" to our script tag, i.e.

This issue can be closed. Thanks!!