javascript - Angular js Map integration -
i new in angular js.now working on angular google map.i have code in javascript. want convert angular js .can me please. in advance..
here html code:-
<div id="map-canvas"></div> <div class="modal fade" id="geotagconfirmationmodal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="close"><span aria-hidden="true">×</span></button> <h4 class="modal-title">geo tag</h4> </div> <div class="modal-body"> <p>do want geotag @ place?…</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal" >no</button> <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="dogeotagging()">yes</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> here javascript code..
<script> var geocoder; var map; var infowindow = new google.maps.infowindow(); var currposition; var geocoderesults; function initialize() { geocoder = new google.maps.geocoder(); var latlng = new google.maps.latlng(40.730885,-73.997383); var mapoptions = { zoom: 18, center: latlng, maptypeid: 'roadmap' } map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); google.maps.event.addlistener(map, 'click', function(e) { codelatlng(e.latlng, map); }); } function codelatlng(position,map) { geocoder.geocode({'latlng': position}, function(results, status) { if (status == google.maps.geocoderstatus.ok) { if (results[1]) { geocoderesults=results[0]; currposition=position; $('#geotagconfirmationmodal').modal('toggle'); } else { alert('no results found'); } } else { alert('geocoder failed due to: ' + status); } }); } google.maps.event.adddomlistener(window, 'load', initialize); function dogeotagging(){ //map.setzoom(11); var marker = new google.maps.marker({ position: currposition, map: map }); //infowindow.setcontent(results[1].formatted_address); infowindow.setcontent("geotagging done @ "+geocoderesults.formatted_address+"!"); infowindow.open(map, marker); return true; } </script>
convert javascript code angularjs quite difficult if new angularjs, especialy if work google maps.
i suggest use existing plugins, , maybe check how made :)
here links angular google maps, or angularjs-google-maps plugins.
Comments
Post a Comment