angular-ui / bootstrap

PLEASE READ THE PROJECT STATUS BELOW. Native AngularJS (Angular) directives for Bootstrap. Smaller footprint (20kB gzipped), no 3rd party JS dependencies (jQuery, bootstrap JS) required. Please read the README.md file before submitting an issue!
http://angular-ui.github.io/bootstrap/
MIT License
14.29k stars 6.73k forks source link

Disable input text but not disable calendar? #6275

Open xingped opened 7 years ago

xingped commented 7 years ago

Bug description:

Is there or can we have a way to disable the input text box but still allow the calendar to work? Currently if the input text is disabled, it disables the whole calendar, but really I just want to prevent users from typing in the date box.

Link to minimally-working plunker that reproduces the issue:

http://plnkr.co/edit/c53OivUuETsY9eN7AE5V?p=preview

Version of Angular, UIBS, and Bootstrap

Angular: 1.5.8

UIBS: 2.1.3

Bootstrap: 3.3.7

roger2hk commented 7 years ago

A dirty workaround plunker http://plnkr.co/edit/QzPLG3SbEIkVEbNAE0BZ?p=preview

wesleycho commented 7 years ago

We actually do this at my workplace, but what we did was use a modal to open the datepicker and not use the datepicker-popup component. That would be an adequate workaround.

As for this, I can see this being a reasonable feature, and would be willing to accept a PR for this. It should be exposed through config though as an attribute on the popup directive.

waliurjs commented 5 years ago

I'm using this as workaround:

<input
  type="text"
  uib-datepicker-popup
  is-open="isOpen"
  ng-keydown="$event.preventDefault(); isOpen = true;"
/>
pritam16mgupta commented 5 years ago

you can use ng-readonly="true" that will work for you

<input type="text" class="form-control" uib-datepicker-popup="{{format}}" ng-model="dtSale" is-open="popup1.opened" datepicker-options="dateOptionsForEndDate" ng-change="CompareDate()" ng-required="true" close-text="Close" alt-input-formats="altInputFormats" ng-readonly="true"/>