I have a problem with the performance of a click event on a marker.
This is my map view:
<div class="map-wrapper">
<map center="{{mapCenter}}" street-view-control="false" zoom-control="false" map-type-control="false" zoom="14">
<marker position="{{place.coords}}" title="{{place.name}}" icon="{{place.icon}}" ng-repeat="place in places" on-click="select(place.id)"></marker>
</map>
</div>
This is a button calling the same function (same view and controller):
<button ng-click="select(null, 13)">My test button</button>
This is my function:
$scope.select = function(event, placeId) {
$log.debug('select called');
$location.path('/places/' + placeId);
};
When I click on the button the console.log appears and location change happens immediately. When I click on the marker the console.log appears immediately but the location change takes up to 5s to happen.
Any idea how this could be?
In my case calling $digest() on $scope in a timeout function did the trick:
$timeout(function () {
$scope.$digest();
});