pushUrlQuery(newQuery, [location])
Updates the URL to have newQuery
as the new set of query parameters, completely replacing what was there previously. Uses push to change the URL, which means the new state will be pushed on to the history stack, so the back button will be able to return you to the previous state.
Arguments
newQuery
(Object): An object mapping query parameter names to values (String).- [
location
] (Object): The location from which the current URL state should be read. If not provided,location
is read from the configuredhistory
or thewindow
.
Returns
(Any): The result of history.push()
, will depend on the history being used.
Examples
// Given URL /page?foo=bar&baz=123&jim=bo
pushUrlQuery({ foo: 'test', jim: 'vlan' });
// URL is now /page?foo=test&jim=vlan