Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // GET parameter to search variable
- $scope.$watch(function() {
- return $location.path();
- }, function(path) {
- $scope.query =path.substr(1).split(/(?:\s|,)+/);
- };
- // Search variable to GET parameter
- $scope.$watch('query', function(newValue, oldValue) {
- if (newValue && newValue != oldValue && $location.path().substr(1) != newValue) {
- $location.path('/search/'+newValue);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement