I have a route that has an optional parameter of a date in the format YYYY-MM-DD
. If a date is not supplied, I will supply today's date.
I defined my route like so:
.state('some.report', {
url: '/report/:reportDate',
templateUrl: 'app/report/report.html',
params:{reportDate:moment().format('YYYY-MM-DD')},
controller: 'reportCtrl',
})
This works, the parameter in the controller is indeed today's date, but the url remains as http://local/some/report/
How can I change it so that url becomes:: http://local/some/report/2015-02-23