Angular.js wrapper for Dan Grosmann's bootstrap date range picker (https://github.com/dangrossman/bootstrap-daterangepicker).
npm install angular-daterangepickerAngular.js directive for Dan Grossmans's Bootstrap Datepicker.
**Beware: Use Bootstrap Datepicker v 2.0.0 and newer!
Older version of datepicker are supported with 0.1.17 release**
bower install angular-daterangepicker --save
`
Manual installation
This directive depends on Bootstrap Datepicker, Bootstrap, Moment.js and jQuery.
Download dependencies above and then use minified or normal version.Basic usage
Assuming that bower installation directory is bower_components. In case of other installation directory, please update paths accordingly.`
`Declare dependency:
`
App = angular.module('app', ['daterangepicker']);
`Prepare model in your controller. The model must have
startDate and endDate attributes:`
exampleApp.controller('TestCtrl', function ($scope) {
$scope.datePicker.date = {startDate: null, endDate: null};
}
`
Then in your HTML just add attribute
date-range-picker to any input and bind it to model.`
`See
example.html for working demo.$3
Do not forget to add a dot (.) in your model object to avoid issues with scope inheritance. E.g. use $scope.datePicker.date instead of $scope.date.Advanced usage
Min and max value can be set via additional attributes:`
`The date picker can be further customized by passing in the
options attribute.`
min="'2014-02-23'" max="'2015-02-25'" options="{separator: ":"}"/>
`Optionally, event handlers can be passed in through the
eventHandlers attribute of options.`
options="{eventHandlers: {'show.daterangepicker': function(ev, picker) { ... }}}"/>
`All event handlers from the Bootstrap daterangepicker are supported. For reference, the complete list is below:
show.daterangepicker: Triggered when the picker is shownhide.daterangepicker: Triggered when the picker is hiddenshowCalendar.daterangepicker: Triggered when the calendar is shownhideCalendar.daterangepicker: Triggered when the calendar is hiddenapply.daterangepicker: Triggered when the apply button is clickedcancel.daterangepicker: Triggered when the cancel button is clickedCompatibility
Version > 0.2.0 requires Bootstrap Datepicker 2.0.0 and newer.
Version > 0.1.1 requires Bootstrap Datepicker 1.3.3 and newer.Links
See original documentation.Issues and Pull Requests
The PRs are more than welcome – thank you for those.Please send PRs only for
*.coffee code. Javascript and minified Javascript should be generated with grunt dist` command