I have a text input that is set to required. The field is a date range picker. When the code for the date range picker enters the text, angular is not recognizing the input as being filled. It is still casing a validation error saying the field is required. Any ideas? I tried $setValidity('required',true); No luck there.
I am using this date range picker: Link
Here's the code. First on the html side, my input:
<input class="form-control" type="text" name="daterange" id="daterange" ng-model="daterange" placeholder="Pick A Date"/>
Then on the javascript side I setup the input as a daterange picker
$('input[name="daterange"]').daterangepicker({
"autoApply": true,
"autoUpdateInput": false
});
$('#daterange').on('apply.daterangepicker', function(ev, picker) {
$('#daterange').val(picker.startDate.format('MM/DD/YYYY') + ' - ' + picker.endDate.format('MM/DD/YYYY'));
});
$('#daterange').on('cancel.daterangepicker', function(ev, picker) {
$('#daterange').val('');
});
I am using some angular on the HTML side to show all my form errors
<ul>
<li ng-repeat="(key, errors) in requestForm.$error track by $index"> <strong>{{ key }}</strong> errors
<ul>
<li ng-repeat="e in errors">{{ e.$name }} has an error: <strong>{{ key }}</strong>.</li>
</ul>
</li>
If I manually type in the field it will validate. But using the date range picker it does not.