newtonjain / hacktheplanet

BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

iframe for route preview #18

Open theshteves opened 9 years ago

theshteves commented 9 years ago
 <iframe width="100%" height="450" frameborder="0" style="border:0;" <!-- display: none -->
            src="https://www.google.com/maps/embed/v1/directions?key=AIzaSyCBYtphSiDRCkgJdo9y3IomkqL2ZjEi1Oc"
            + "&origin=" + "berlin"
            + "&waypoints=" + "dusseldorf"
            + "&destination=" + "munich" allowfullscreen>
    </iframe>

obviously the src tag needs to have everything in one string. I need Newton to use his angular magic to formulaic offload all of the lat-long points into the src url.

theshteves commented 9 years ago

HTML:

<iframe width="100%" height="450" frameborder="0" style="border:0;" allowfullscreen></iframe>

JAVASCRIPT:

//on event
        var requrl= "https://www.google.com/maps/embed/v1/directions"
            + "?key=AIzaSyCBYtphSiDRCkgJdo9y3IomkqL2ZjEi1Oc"
            + "&origin=" + // origin, comma-seperated lat-long
            + "&waypoints=" + // middle-points, comma-seperated lat-longs, seperated by pipes(" | ")
            + "&destination=" + ; // destination, comma-seperated lat-long
        document.getElementsByTagName("iframe")[0].setAttribute("src", requrl);