I initialize a google map within a angularJS controller and add a listener to map event
google.maps.event.addListener(map, 'dragend', MapMoveAround);
......
function MapMoveAround() {
console.log($location.url());
$location.path('/other_path');
console.log($location.url());
}
The console shows the url is changed when I trigger the google map event, but I stay at the old page. If I change $location.path('/other_path') to
window.location.replace('/#/other_path')
it will go the new page, but "Back" button won't work.
Can anyone provide an AngularJS solution for it?
$scope.$apply()in order to run digest cycle