AngularJS Search Change Event -



AngularJS Search Change Event -

i need event $routechangesuccess $location.search() variable. calling $location.search('newview'), , need way know when changes.

thanks!

you should utilize $scope.$watch:

class="lang-js prettyprint-override">$scope.$watch(function(){ homecoming $location.search() }, function(){ // reaction });

see more $watch in angular docs.

if looking add-on of 'newview', query string above code work.

i.e. http://server/page http://server/page?newvalue

however, if looking alter in 'newview' above code not work.

i.e http://server/page?newvalue=a http://server/page?newvalue=b

you need utilize 'objectequality' param phone call $watch. causes $watch utilize value equality, instead of object reference equality.

class="lang-js prettyprint-override">$scope.$watch(function(){ homecoming $location.search() }, function(){ // reaction }, true);

notice add-on of 3rd param (true).

search angularjs

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -