Here are a couple states from my app:
angular.module("app").config([
'$stateProvider', '$urlRouterProvider', '$httpProvider', function ($stateProvider, $urlRouterProvider, $httpProvider) {
'use strict';
$httpProvider.defaults.withCredentials = true;
//#region Routing
$urlRouterProvider.otherwise("/login");
$stateProvider.state('client1', {
onEnter: function () { },
views: {
"index": {
templateUrl: 'indexView.html'
}
}
}).state('client1.deliverables', {
url: '/deliverables/:taxYear/:entity/:deliverable/:status',
onEnter: function () { },
views: {
"nav": {
templateUrl: 'Nav/nav.html',
controller: 'NavController'
},
"content": {
templateUrl: 'deliverables/deliverables.html',
controller: 'DeliverablesController'
},
"footer": {
templateUrl: 'footer.html',
},
reloadOnSearch: false
}
On occasion, I want to load the deliverables state with default parameters. I'd prefer not to use dummy strings... Is there a better way to do this?
$state.go('^.deliverables', {
taxYear: null,
entity: null,
status: null
}); // Navigate to dashboard
But then I wind up with three slashes on my URL. http://example.com/#/deliverables////. Is there a way to make a more friendly URL without using dummy parameters? Is there a better way to do this without winding up with three slashes in a row? It's not the end of the world, but it looks foreign.
If I create two different states, then I have to replicate all of the state information twice.
EDIT: Sometimes I want to load this page with all nullable parameters. But when I do so, I get three consecutive slashes. Other times, I want to change to the state and provide actual values. That works fine. Is there a way to handle this without duplicating the state information into two states?
EDIT2: The page has 4 inputs that filter a jquery datatable. On first page load of the deliverables page, I would not like to filter by any of the inputs. I would also be able to do the angular equivalent of deep linking into the page. These deep links would then filter the table. This is why I have the parameters on the URL