Ionic et Maps?

Par wowoteur, il y a 10 ans


Bonjour,
J'essaie de faire une application android avec ionic.
Et je souhaite mettre une vue google Maps.
Celle-ci:

var markers = [{ "EXP": "PORNIC", "SITE": null, "IDPAV": "1PP", "CONTRAT": "CC Pornic", "GEOLOC": " 47.1160354, -2.0699331", "ADRESSE": "LA PERINIERE", "CP": "44210", "COMMUNE": "Pornic", "FLUX": "Plats", "PHOTO": "c4064f44056pu33056_20150918143959.jpg", "VOLUME": "PAV 4m3 " }, { "EXP": "PORNIC", "SITE": null, "IDPAV": "36PP", "CONTRAT": "CC Pornic", "GEOLOC": " 47.12426156, -2.05369004", "ADRESSE": "RUE DU PLESSIS ALLAIS", "CP": "44210", "COMMUNE": "Pornic", "FLUX": "Plats", "PHOTO": "c4064f44056pu33056_20151019102257.jpg", "VOLUME": "PAV 4m3 " }]; window.onload = function() { LoadMap(); } function LoadMap() { var mapOptions = { center: new google.maps.LatLng(46.624425, 2.416611), zoom: 7, mapTypeId: google.maps.MapTypeId.ROADMAP }; var infoWindow = new google.maps.InfoWindow(); var latlngbounds = new google.maps.LatLngBounds(); var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions); for (var i = 0; i < markers.length; i++) { var data = markers[i] var splited = data.GEOLOC.split(','); var myLatlng = new google.maps.LatLng(splited[0], splited[1]); var marker = new google.maps.Marker({ position: myLatlng, map: map, title: data.IDPAV, icon: "img/"+ data.FLUX + ".png" }); (function(marker, data) { google.maps.event.addListener(marker, "click", function(e) { infoWindow.setContent("<div style='text-align: center'>Contrat: <b>" + data.CONTRAT + "</b><br>N°PAV: <b>" + data.IDPAV + "</b><br>Flux: <b>" + data.FLUX + "</b><br>Volume: <b>" + data.VOLUME + "</b><br><img src='img/PAV/" + data.PHOTO + "''></div>"); infoWindow.open(map, marker); }); })(marker, data); latlngbounds.extend(marker.position); } var bounds = new google.maps.LatLngBounds(); map.setCenter(latlngbounds.getCenter()); map.fitBounds(latlngbounds); }

Par contre, je ne sais pas comment le modifier pour le rendre visible sous IONIC.
Est-ce que quelqu'un peut m'aider?
Merci d'avance.

3 réponses

mckenziearts, il y a 10 ans

Bonjour j'ai lemême probleme que Toi mais apparament il ya ngCordava qui permet de faire cela. Recuperer la position actuelle est assez simple mais faire une map c'est unpeu bizarre je dirai c'est pas comme avec du javascript. Là je bloque

mckenziearts, il y a 10 ans

J'ai trouvé deux scripts que tu peux utiliser pour tracer ta map chez moi sa marche en tout cas voici les liens avec ngMaps et l'autre avec http://codepen.io/ionic/pen/uzngt

wowoteur, il y a 10 ans

Merci, je regarde.