Set input with datepicker to any string in AngularJS 1.5.8

816 views Asked by At

this may be a simple question, but I have looked and cannot find my answer...

I have an input box with an Angular-UI Bootstrap datepicker:

<input type="text" class="form-control" 
    id="id" name="id"
    uib-datepicker-popup="MMddyyyy" ng-model="date" 
    is-open="isDatePickerOpen" 
    close-text="Close" />
<span class="input-group-btn">
    <button type="button" class="btn btn-default" ng-click="openFrom($event)"><i class="glyphicon glyphicon-calendar"></i></button>
</span>

This works fine for selecting dates. I can also enter free-form text, but it only binds properly when I enter a date in the format specified. If I enter something else like 'abcd', it binds to undefined. I suspect the datepicker itself is putting restrictions on what is allowed in the input box, but not sure how to remove those restrictions. I am open to using any datepicker that is supported by most browsers.

0

There are 0 answers