Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to bind data to the map in the code behind? #3

Closed
kvnphllps opened this issue Nov 14, 2015 · 2 comments
Closed

How to bind data to the map in the code behind? #3

kvnphllps opened this issue Nov 14, 2015 · 2 comments

Comments

@kvnphllps
Copy link

Hi @dapriett - Sorry to keep bugging you! I was wondering how one binds data to the map in the xml:

<maps:mapView id="theMap" latitude = "{{ latitude }}" longitude = "{{ longitude }} zoom = "{{ zoom }}" mapReady="OnMapReady" /> 

from the code behind? I've tried setting the bindingContext of gMap with no luck. Any suggestions?

@dapriett
Copy link
Owner

Hi @kvnphllps - you can only bind the camera position of the map at the moment: latitude, latitude, zoom, bearing, and tilt

In your code https://github.com/kvnphllps/nativescript-map-app/blob/master/app/main-page.js#L6 you can add those to your pageData

var pageData = new observableModule.Observable({
     latitude: -33.86,
     longitude: 151.20,
     zoom: 12
});

For marker data, you'll need to add each one in javascript as you're doing in OnMapReady. There isn't a way to bind map marker data in the view, although that would be something cool to add in the future.

@kvnphllps
Copy link
Author

@dapriett, Thanks again!

dapriett pushed a commit that referenced this issue May 1, 2016
febriarief pushed a commit to febriarief/esolution-nativescript-google-maps-sdk that referenced this issue Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants