How to display a Google Map on Worklight App

后端 未结 2 1245
无人共我
无人共我 2020-12-20 10:23

I have the following files in Worklight. I want to load the map on the worklight app. It is visible in the \"Design\" view but neither on simulator nor on emulator. Kindly h

相关标签:
2条回答
  • 2020-12-20 11:06

    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;
        }
    }
    
    0 讨论(0)
  • 2020-12-20 11:08

    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:

    • Multi-page application with Google Maps

    Tesed in Worklight Console preview as well as iOS Simulator.

    0 讨论(0)
提交回复
热议问题