javascript - Google map in Angular JS: Event listener in a marker doesn't redirect -
i'm having small problem when trying attach event listener google maps marker redirects different route using angular.
my code similar this google example, , here's how define listener angularjs controller:
marker.branchid = 35; google.maps.event.addlistener(marker, 'click', function () { $location.path('/showbranch/' + this.branchid); }); markers.push(marker); on chrome debugger can see $location object there (it's not null nor undefined) , id need right 1 too. no error message shown on console after clicking on marker, redirection not effective right after clicking on marker.
however, if click on marker , after that, click on other button of page, routing performed (that is, redirected route looking when clicking on marker). seems sort of scope problem, don't find solution. have hint?
thanks lot!!
window.location.href = '/showbranch/' + this.branchid;
tried this?
Comments
Post a Comment