A simple and fluid inline datepicker for AngularJS with no extra dependencies.
- Add the
pickadate
module to your dependencies
angular.module('myApp', ['pickadate']);
- Use the
pickadate
directive in any element
<div pickadate ng-model="date"></div>
Pickadate is fluid, so it will take the width of the parent container.
<div pickadate ng-model="date" min-date="minDate" max-date="maxDate"></div>
function MyAppController($scope) {
$scope.minDate = '2013-11-10';
$scope.maxDate = '2013-12-31';
}
min-date
and max-date
take angular expressions, so if you want to specify the values inline, don't forget the quotes!
<div pickadate ng-model="date" min-date="'2013-11-10'" max-date="'2013-12-31'"></div>
<div pickadate ng-model="date" disabled-dates="disabledDates"></div>
function MyAppController($scope) {
$scope.disabledDates = ['2013-11-10', '2013-11-15', '2013-11-19'];
}
Pickadate uses angular $locale
module. If you want to have the calendar in any other language, please include the corresponding AngularJS i18n files. You can get them here: http://code.angularjs.org/1.2.0-rc.2/i18n/
Currently pickadate
only works as an inline datepicker, but would like it to make it work in any text input as an overlay like the jquery-ui
one. Will be happy to merge your pull requests.
Copyright (c) 2013 Restorando
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.