I use **angular-ui slider** to select a desired range:

**HTML**

```
<div ng-init="sizeRange.val = [10, 80]">
    <div ui-slider="sizeRange.options"
        min="10" max="80" step="5"
        ng-model="sizeRange.val"></div>
    <input type="number" ng-model="sizeRange.val[0]">
    <input type="number" ng-model="sizeRange.val[1]">
</div>

```

When user moves the slider to the desired number and stops, the following function is triggered that appends the selected range to URL query string:

```
app.controller('MainCtrl', ['$scope', '$location', function ($scope, $location) {
    $scope.sizeRange= {
        'options': {
            range: true,
            stop: function (event, ui) { $scope.filterUpdate($scope.sizeRange.val); }
        }
    };

    $scope.filterUpdate = function (size) {
        console.log(size);
        $location.search({"sizeRange": size});
    };
}

```

So when I move the slider the first time, the `$location.search()` is not triggered and no URL string is appended, however the function itself seems to be called successfully, because I can see the log and correct selected values in my console called from within the function. When I move the slider the second time, the URL string is now appended, but it contains old data from the first time I moved the slider. So every time I move it, the `$location.search()` updates URL string with data from previous move.

What can be interfering with the `$location.search()` to prevent it to work correctly?