javascript - Angular google Map will not render and throws no errors -
i new angular think have right. pretty simple setup.
here app
var applocations = angular.module('locations', ['uigmapgoogle-maps']).config(function(uigmapgooglemapapiprovider) { uigmapgooglemapapiprovider.configure({ // key: 'i not providing key', v: '3.17', libraries: 'weather,geometry,visualization' }); }); applocations.controller('locationscontroller', function($scope, $http) { $http.get('/json/locations/') .then(function(res){ $scope.locations = res.data; }); }); applocations.controller('mapcontroller', function($scope, $http) { $http.get('/json/locations/') .then(function(res){ $scope.locations = res.data; }); $scope.map = { center: { latitude: 45, longitude: -73 }, zoom: 8 }; });
here markup
<div class="main1-in" ng-app="locations"> <div ng-controller="mapcontroller"> <ui-gmap-google-map></ui-gmap-google-map> </div> <div class="health-care large-12 medium-11 small-12"> <h1>welcome</h1> <?php dynamic_sidebar('welcome')?> </div> <div class="location large-12 medium-12 small-12" ng-controller="locationscontroller"> <h2>locations</h2> <div class="search"> <input type="text" class="text-field" value="find location" ng-model="search" placeholder="search..."> <span><i class="fa fa-search"></i></span> <div class="clear"></div> </div> <div class="clear"></div> <div class="location-carousel large-12 medium-12 small-12"> <ul> <li ng-repeat="location in locations | filter:search"> <div class="location-in" itemscope itemtype="http://schema.org/medicalclinic"> <img src="{{location.thumbnail[0]}}" alt="img" width="273" height="157"> <h6><span itemprop="name">{{location.name}}</span></h6> <p itemprop="address" itemscope itemtype="http://schema.org/postaladdress"> <span itemprop="streetaddress">{{location.address1}} {{location.address2}}</span><br> <span itemprop="addresslocality">{{location.city}}</span>, <span itemprop="addressregion">{{location.state}}</span> <span itemprop="postalcode">{{location.zip}}</span> </p> <small itemprop="telephone">{{location.phonenumber}}</small> <a href="{{location.permalink}}" itemprop="url">visit location page</a> </div> </li> </ul> </div> </div> </div>
i no errors in console. rest of application renders map not. appreciated.
all operations correct according documentation, except 1 thing, need mention map center , zoom level map start with, see quickstart documentation
<ui-gmap-google-map center='map.center' zoom='map.zoom'></ui-gmap-google-map>
map.center
, map.zoom
gets picked mapcontroller have provided, local-copy works me. check if hold problems other parts of code.
and definitely,
.angular-google-map-container { height: 400px; }
into css, or dynamically set height accessing dom.
Comments
Post a Comment