How to display a Google Map on Worklight App

[亡魂溺海] 提交于 2019-11-29 13:05:36

Major revision to the answer based on the comments and edits made to the question

See the following Worklight 6.1.0.1 sample project, that demonstrates page navigation and loading of Google Maps in another page in the app.

This sample is based on the same multi-page sample provided by IBM, that your code snippets above are based on:

Tesed in Worklight Console preview as well as iOS Simulator.

Better separate the Javascript from the index.html file and then follow the below steps.

You can simply pass the value on onchange event like

<select onchange="initialize(" + this.value + ")">

Then

function initialize(value) { // process the value
  var myLatlng1 = new google.maps.LatLng(28.5084805,77.2272778);
  var myLatlng2 = new google.maps.LatLng(28.6473116,77.1559846);
  var mapOptions = {
    zoom: 11,
    switch(value){
     case "south": center: myLatlng1; break;
     case "west": center: myLatlng2; break;
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!