I am currently using angular ui router to navigate between different pages and I have a route that includes multiple query parameters. The issue I am encountering is that when I switch routes for the same page with new query parameters, the existing parameters are not being removed.
For example, if my current URL is
localhost:8080/myapp/#/myPath?barId=098
and I try to navigate using one of the options below, I end up at URL localhost:8080/myapp/#/myPath?barId=098&fooId=123
instead of the desired localhost:8080/myapp/#/myPath?fooId=123
I attempted using ui-sref="myPath({fooId:123}"
and $state.go("myPath", {fooId:123})
, but both approaches lead to the same unwanted result. Is there a method to effectively remove existing parameters?
Below is the state definition:
.state('myPath', {
url: '/myPath?fooId&barId&fluffyId&anotherId',
templateUrl: 'foo.html',
controller: MyController
})