html - google map not displaying in webpage -


html :

<ui-gmap-google-map center='map.center' zoom='map.zoom' control="map.control">     <ui-gmap-marker ng-repeat="marker in markers" coords="marker.coords" options="marker.options" events="marker.events" idkey="marker.id">         <ui-gmap-window show="true">             <div class="popup">                 {{marker.content}}             </div>         </ui-gmap-window>     </ui-gmap-marker> </ui-gmap-google-map> 

js:

controller part :

// google maps

$scope.map = {     center: {         latitude: 0,         longitude: 0     },     zoom: 1,     maptypeid: google.maps.maptypeid.roadmap,     control: {} };  // place marker $scope.markers = [];  function setmarker(lat, long, title, content) {     var marker = {         id: $scope.markers.length+1,         coords: {             latitude: lat,             longitude: long         },         content: content,         options: {             title: title,             icon: 'https://maps.google.com/mapfiles/ms/icons/green-dot.png'         }     };     $scope.markers.push(marker); };  $scope.drawmap = function(response) {     console.log("drawmap");     $scope.markers = [];     var data = response.json.response.data[0].data[1];     var markerlatlng = [];     var map = $scope.map.control.getgmap();     var bounds  = new google.maps.latlngbounds();       // set zoom level based on xlabel     var level = response.json.response.data[0].xlabel;     if (level === 'country') {         $scope.map.zoom = 4;     } else if (level === 'state') {         $scope.map.zoom = 4;     } else if (level === 'city') {         $scope.map.zoom = 6;     } else if (level === 'all centres') {         $scope.map.zoom = 8;     }else if (level ==='divisons'){         $scope.map.zoom =10;     } else {         $scope.map.zoom = 4;  //default zoom 10     };       //set markers each data     $.each(data, function(key, entry) {         setmarker(entry.lat, entry.long,                  entry.x,                  /*response.json.response.data[0].data[0] +*/                   response.json.response.data[0].s1 + ": " + entry.s1 + " "+" "+             response.json.response.data[0].s2 + ": " + entry.s2);        var point = new google.maps.latlng(entry.lat, entry.long);         markerlatlng.push(point);        var loc = new google.maps.latlng(entry.lat, entry.long);        bounds.extend(loc);     });      map.fitbounds(bounds);   } 

i have above html , js display map data in web page. default map takes css property position absolute when give fixed map displayed in webpage, throughout entire webpage map covered. when give position fixed , can find map marker of data given in response. issue here.

i took map-container , given width:600px; , height:400px; position : fixed map generated.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -