I am using Nicolas Laplante google-maps (http://nlaplante.github.io/angular-google-maps/) module. I have problem when passing coordinates for center property from asynchronous call:
This is my controller:
app.controller('baznaCtrl',function($scope,$routeParams,$http){
$scope.idB=$routeParams;
$scope.latitude=0;
$scope.longitude=0;
$http.get('https://my web service/json/'+$scope.idB.lokid).success(function(data){
$scope.bs=data;
$scope.latitude=$scope.bs.lattitude.replace(',','.');
$scope.longitude=$scope.bs.longitude.replace(',','.');
});
angular.extend($scope,{
center : {
latitude: $scope.latitude,
longitude:$scope.longitude
},
markers:[],
zoom: 8
});
});
It seems that google-map does not changing it's center property when data comes from $http
call. It is always 0,0 (because of initial values of $scope.latitude
and $scope.longitude
).