Open pblanchardie opened 4 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
This does not mean that the issue is invalid. Valid issues may be reopened.
Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
This does not mean that the issue is invalid. Valid issues may be reopened.
Thank you for your contributions.
I'm getting the same error message with the same setup. The workaround I'm using is to use undefined
instead.
$stateProvider.state('page', {
url: '/page?{somedate:date}',
templateUrl: './page.html',
dynamic: true,
params: {
somedate: {
value: undefined
}
}
});
Using undefined
, I'm bypassing the Param.prototype.isDefaultValue(value)
(param.js) check which calls type.equals(l, r)
. All types are using simple .equals
or ==
check, but date
-type check whether getFullYear()
, getMonth()
, getDate()
are the same values.
The null problem aside, notice that the date
-type only check for year, month, date but time component is not checked. So, I think the param type meant specifically date-only, not referring to JavaScript Date object.
Hence, if date-time is involve, best leave it as a string-type, the alternative workaround -- dropping date
:
$stateProvider.state('page', {
url: '/page?somedate',
templateUrl: './page.html',
dynamic: true,
params: {
somedate: {
value: undefined
}
}
});
This is a (check one box):
My version of UI-Router is: (type version)
1.0.27
Bug Report
Current Behavior:
A URL param declaration with
type: 'date'
and defaultvalue: null
throws:Cannot read property 'getFullYear' of null
Expected Behavior:
It should work and set null as default value for this param
Link to Plunker or stackblitz that reproduces the issue:
( if you want a response to your issue, provide a way to reproduce it ) ( http://bit.ly/UIR-Plunk1 ) ( https://stackblitz.com/edit/ui-router-angularjs )