Comments (40)
I added you Nuget package got it to compile but when I ran it I get the following error
from blazorgooglemaps.
@Karluzo this is not mine. This is @rungwiroon . I will delete it aslo from repository
from blazorgooglemaps.
@Karluzo Lets clarify scenarios which isnt working for you.
- Create server side Blazor project. Then create component in shared folder using BlazorGoogleMaps and using it in in razor pages you get error. I will investigate this scenario
- What do you mean normal pages project? Could you write down steps how we could try reproduce it?
from blazorgooglemaps.
Ive been having this issue and I fixed it by changing the Rendermode to Server in the host file. If it is set to ServerPrerendered it will not work (was getting exactly the same object reference error as shown above). Hope this helps :)
from blazorgooglemaps.
@Cameron097 yes i will add. This week was pretty busy. Hope next week will have more time and will udpdate docs
from blazorgooglemaps.
There is issue with embedding local JavaScript to server side applications. Will update soon
from blazorgooglemaps.
Thanks for the response
from blazorgooglemaps.
I saw there was a fork created to attempt a fix for this. Any luck?
from blazorgooglemaps.
I am fallowing procedure to wait for confirmation of valid code. Made pull request. As short workaround you could try add this nuget Vlasdkoqw. I was testing if my fix helped with this nuget. Just add later will need just to replace nuget after our release. I could update here when we release update.
from blazorgooglemaps.
Here's the page code.
@page "/maptest"
@using GoogleMapsComponents.Maps
@using Vlasdkoqw
Google Map
<GoogleMap @ref:suppressField @ref="@map1" Id="map1" Options="@mapOptions">
@functions {
private GoogleMap map1;
private MapOptions mapOptions;
protected override void OnInitialized()
{
mapOptions = new MapOptions()
{
Zoom = 13,
Center = new LatLngLiteral()
{
Lat = 13.505892,
Lng = 100.8162
},
MapTypeId = MapTypeId.Roadmap
};
}
}
from blazorgooglemaps.
I updated readme a bit. Did you added script tag to _Host.cshtml also google script tag (with your key of course)? Do you use preview8?
<script src="_content/Vlasdkoqw/objectManager.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY&v=3"></script>
from blazorgooglemaps.
I had the google api URL but I didn't have the objectManager.js in the _Host.cshtml file. I added that and tried it again. Same result.
I also have services.AddBlazorGoogleMaps(); in my Startup.cs
from blazorgooglemaps.
From small stack trace part i see that error comes not from component itself. Could you try create new solution and fallow steps i provided. In your case I think it could be some conflicts in preview libraries. Please check github.com/dotnet/aspnetcore/issues/13133 and maybe it could help to solve issue.
from blazorgooglemaps.
Does issue still exist in preview 9.
Temporally i update lib to other package while i get access to update this lib packages
https://www.nuget.org/packages/Vlasdkoqw/1.0.2
Please fallow migration instructions and let me know
https://devblogs.microsoft.com/aspnet/asp-net-core-and-blazor-updates-in-net-core-3-0-preview-9/
from blazorgooglemaps.
from blazorgooglemaps.
from blazorgooglemaps.
I dont see screen shot. Could you copy past stack trace?
from blazorgooglemaps.
from blazorgooglemaps.
I tried to recreate scenario to get exception. I go very similar result when i dont put script tags into _Host.cshtml
Could you confirm that these lines exist in _Host.cshtml file?
Ps please change YOUR_KEY with your google key
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY&v=3"></script>
<script src="_content/Vlasdkoqw/objectManager.js"></script>
from blazorgooglemaps.
from blazorgooglemaps.
I am lost. I dont know hot to help. Last thing, could you try add simple component like this with preview9 or rc1 and let me know if it works
@page "/counter"
@using GoogleMapsComponents
@using GoogleMapsComponents.Maps
<h1>Counter</h1>
<GoogleMap @ref="@map1" Id="map1" Options="@mapOptions"></GoogleMap>
@code {
private GoogleMap map1;
private MapOptions mapOptions;
protected override void OnInitialized()
{
mapOptions = new MapOptions()
{
Zoom = 13,
Center = new LatLngLiteral()
{
Lat = 13.505892,
Lng = 100.8162
},
MapTypeId = MapTypeId.Roadmap
};
}
}
from blazorgooglemaps.
from blazorgooglemaps.
I think you need map options. It should work without it. Could you try to start new solution. Add that component #7 (comment) . Add lines to _Host.cshtml if it wont work please add to zip and upload here.
from blazorgooglemaps.
from blazorgooglemaps.
@rungwiroon hey man please update nuget.
@Redeye51 awesome. Happy to hear. If you will have some issues let me know. I had been using it at some aspects. I also could help solve some other issues related to maps.
from blazorgooglemaps.
from blazorgooglemaps.
@valentasm1
I will update it tonight.
from blazorgooglemaps.
@rungwiroon I also updated solution to 3.0.0 and recreated demos. Also added Guid to polyline. Had case when needed access it from local js. I think we should think about other solutions in future.
from blazorgooglemaps.
I already started work for better JS objects interop but don't have time to finish it yet.
from blazorgooglemaps.
I've uploaded the new nuget package version 4.6.0-alpha.
Please help to check if it works correctly.
from blazorgooglemaps.
from blazorgooglemaps.
from blazorgooglemaps.
I could confirm that it works for me. Client side version.
from blazorgooglemaps.
@valentasm1 You should delete your Google maps API key from this public chat.
from blazorgooglemaps.
I have the same problem. I have created empty Blazor project, added latest alpha version and modified _Host.cshtml file. I have observed that when I put the my razor component in Shared folder (with no _Host.cshtml in it) I get the error. Otherwise I do not get the error - in Pages folder. Still I can get only the text "Sorry, there's nothing at this address."
When I am trying to make the BlazorGoogleMaps work in normal Razor pages project (but in a razor component), there is no _host.cshtml to modify and I am getting still the error.
from blazorgooglemaps.
Thanks, I am learning razor and blazor and I am using this scenario for my project - using razor components in a razor page:
https://www.mikesdotnetting.com/article/338/using-razor-components-in-a-razor-page
using RenderComponentAsync.
from blazorgooglemaps.
May be worth adding that to the docs until a work around is found or maybe that's just how it's meant to be?
from blazorgooglemaps.
@Karluzo do you still have issue after apply RenderComponentAsync ?
from blazorgooglemaps.
@Karluzo do you still have issue after apply RenderComponentAsync ?
Could i close issue?
from blazorgooglemaps.
Closing due inactivity
from blazorgooglemaps.
Related Issues (20)
- Accessing the map object via javascript HOT 4
- Working with encoded polylines. HOT 2
- Multiple Ground Overlays HOT 3
- DrawingManager.SetDrawingMode no longer works in 3.3.2 and newer HOT 7
- Add class DragEndEvent for dragend listener (Suggestion) HOT 1
- MarkerClustering - Set Click on Zoom level; HOT 2
- polygonList not rendering the polygons HOT 9
- Advanced Markers server side demo dont work anymore HOT 4
- Link KeyProvider to map object scope instead of application level static HOT 2
- Advanced Marker Support HOT 4
- AdvancedMapMarker Microsoft.JSInterop.JSException: function not found HOT 1
- Enabling Dependabot for repository
- AdvancedMarkerElementOptions - Content Invalid (not an instance of Node) HOT 13
- New method services.AddBlazorGoogleMaps("YOUR_KEY_GOES_HERE"); only is used in Maps, not other components HOT 1
- Blazor web app demo HOT 1
- Removed map HTMLElement from DOM still try to render map HOT 14
- Add Support for PinElement (AdvancedMarkerElement Customization) HOT 8
- AdvancedMarker from svg HOT 4
- Add way to set AdvancedMarker properties HOT 6
- Feature: Traffic, Transit and Bicycle Layer HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blazorgooglemaps.