How to know the source of the event in Angularjs -
i looking way know source of event in angularjs routing. here scenario trying solve. when url changes want know whether change caused browser button or not. thought can
$scope.$on('$routeupdate', function (event) { //if source button stuff // if not }); but event object doesn't have source information. did miss here? there better way it?
instead of $routeupdate use '$locationchangestart'
here's discussion angularjs guys: https://github.com/angular/angular.js/issues/2109
example:
$scope.$on('$locationchangestart', function(event) { if ($scope.form.$invalid) { event.preventdefault(); } });
Comments
Post a Comment