angularjs: checking url location change -


i'm watching $locationchangesuccess event. need clean way check whether url has changed or if parameters have changed. compare 'next' , 'current' parameters, maybe there's function doing ?

set custom watch:

function myctrl($scope, $location) {   // watch parameters...   $scope.$watch(function() {     return $location.search();   }, function(newparams, oldparams) {     console.log(newparams);     console.log(oldparams);   }, true); } 

note third argument true passed $scope.$watch(); important ensure watch value, in case object, watched changes (and not referentially).


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -