I am working on a AngularJS project v1.5.8, which is using angular-ui-router. The routes are setup something like this:
var myApp = angular.module('demoapp', ['ui.router']);
myApp.config(function($stateProvider) {
$stateProvider
.state('landing', {
url: '/?paramOne¶mTwo¶mThree',
template: '<h3>Landing Page with params.</h3>',
})
.state('landing.pageA', {
url: '',
template: '<h3>Landing Page A!</h3>',
})
.state('landing.pageB', {
url: '',
template: '<h3>Landing Page B!</h3>',
})
.state('error', {
url: '/error',
template: '<h3>Error Page!</h3>',
});
$urlRouterProvider.otherwise('/');
});
For the landing
states, the params are not always passed in the order specified.
And sometimes, one or more of the params is omitted. A different service redirect to this app and passes the query params.
- Is there a way to make to make some or all of the params optional?
- Require only the first one, and it should not matter if the rest are passed?
- Make the order they are being passed not matter? But, still render the template specified under state
landing
.