I have a text input within an ng-repeat. When I click on the input I'm attaching a date picker and triggering a change() on the input when the date is selected.
$(this).val(picker.startDate.format(datePickerOutputFormat)).change();
This works and AngularJS scope picks up the change. I have a span on the page that is bound to the date value so I can see this changing.
On the input, I want to highlight null dates using ng-class with the following.
<input type="text"
class="form-control single-date-input"
placeholder="dd/mm/yyyy"
ng-model="demoInRepeat.date"
ng-class="{ 'invalid-input' : null == demoInRepeat.date }">
This works fine, until I manual edit the input value and delete the date. If I pick the date off the date picker again the invalid-input class remains even though the value update on both the input and on the span I'm using to show the scope is changing.
Even if I display the evaluated value of the ng-class condition, this shows true/false as expected.
{{ null == demoInRepeat.date }}
I would expect the invalid-input class to be removed once the date is re-selected. Any ideas?
Using AngularJS v1.5.8