I'm using ui-router
project to handle my web-app navigations. In my screens I have input widgets (like date-picker and selectors) which change the query parameters in the url. In order to do so I declare the state as follows:
angular.module('my.project', ['ui.router', 'ngMaterial'])
.config(['$stateProvider', function ($stateProvider) {
$stateProvider
.state('page', {
url: '/page?customerid%from%to',
// rest of state definition
})});
Then, when things change on screen, I use $state.go()
. For example, if the from widget changes I call $state.go('.', {from: fromwidget.text})
which changes the url.
Thing is, I have a lot of parameters that can change and I feel it's a bit redundant to define each of these params in the url
section of the state
definition. I would like to just declare the base-url, in my case url: '/page'
and when I call $state.go()
to change the $stateParams
and just use them in my controller. I don't have any need to know in advance the exact parameters that are allowed to be passed to the state