Sunday 23 April 2017

How can I generate dynamic javascript with express for a google maps script?

Say I wanted to generate markers on the map based off whats in the database. In my map.jade how can I iterate of the array to generate dynamic js for the google maps script that makes the map?Say I have this hardcoded in my gmaps script in maps.jadevar irouleguy_coords = [{ lng: -1.405220, lat: 43.270706 },{ lng: -1.404190, lat: 43.271206 }]; Say I now wanted to generate a bunch of these based off:for region in regionslist and use #{region.coordinates} to generate dynamic variables like var coord_1 = #{region.coordinates}Do I have to do this in my route and then pass to the template?

Submitted April 24, 2017 at 04:23AM by mineralwatersoda

No comments:

Post a Comment