lundi 16 février 2015

Adding marker on centered map: AngularJS


I am having a very hard time coping with AngularJS and its way of setting up maps and markers.


Right now I have the following code:



<map data-ng-model="mymapdetail" zoom="11"
center="{{item.coordinates}}" style="heigth:375px">
<div data-ng-model="mymarker"></div>
</map>


This correctly shows a centered map. Then I am trying to add a marker this way.



$scope.mymarker = new google.maps.Marker({
map: $scope.mymapdetail,
position: new google.maps.LatLng(item.coordinates),
title: woa.title
});


This code does not produce any results. Where is it wrong?





Aucun commentaire:

Enregistrer un commentaire