I have a page which displays products from a JSON REST web service. Not sure if this is the best way, but I am trying to use query parameters on the page to be able to filter based on MinPrice and MaxPrice (other filters would be added later as well) - however, i can't get multiple parameters working.
for example:
MinPrice and MaxPrice are both optional.
When I click MinPrice 30, i get the following URL, which is fine:
#/minPriceParam=3
If i then click MaxPrice 60, I would expect
#/minPriceParam=30&maxPriceParam=60
however what i actually get is
#/maxPriceParam=60 i.e. it's lost the minPriceParam=30 part.
this is the simplified code that i have
<a ui-sref="minPrice({ minPriceParam:30 })"> MinPrice 30</a>
<a ui-sref="maxPrice({ maxPriceParam:60 })"> MaxPrice 60</a>
JS File
app.config(function ($stateProvider, $urlRouterProvider) {
$stateProvider
.state('minPrice', {
url: '/?minPriceParam&maxPriceParam'
, controller: function ($scope, $StateParams)
{$scope.minimumPrice = $StateParams.min;}
})
.state('maxPrice', {
url: '/?minPriceParam&maxPriceParam'
, controller: function ($scope, $StateParams) { $scope.maximumPrice = $StateParams.max; }
})
});