Closed xoloinc closed 8 years ago
just saw Add back check for undefined model value #136 solves this
As #136 is not merged yet in 2o18
In our project I fixed this by exposing model date and options objects to the controller scope:
View:
<div
date-range-picker
ng-model="date"
options="options"
></div>
Controller:
$scope.options = {
showDropdowns: true,
opens: 'left',
drops: 'down',
applyClass: 'btn-primary'
};
$scope.date = {
startDate: moment(),
endDate: moment()
};
When you initiate the picker with an null value for date, the formatter push iteration fails, throwing a
TypeError: Cannot read property 'startDate' of undefined
The if statement first checks if singleDatePicker && date is set, if not, next step checks for objValue.startDate only, which makes the error to occur caused by objValue being a null value.
This should be fixed by adding a check for both objValue && objValue.startDate in the clause.
to
or am I missing something?