Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.

Commit 91260af

Browse files
committed
datepicker-class new attribute
1 parent cabd63d commit 91260af

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

README.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The Angularjs Datepicker is developed by [720kb](http://720kb.net).
1111

1212
##Requirements
1313

14-
AngularJS v1.2+
14+
AngularJS v1.3+
1515

1616
###Browser support
1717

@@ -84,6 +84,7 @@ date-set-hidden="" | String(Boolean) | false | Set the default date to be shown
8484
date-disabled-dates="" | String([Date(), Date(), ...]) | false | Disable specific dates using an _Array_ of dates
8585
date-refocus="" | String(Boolean) | false | Set the datepicker to re-focus the input after selecting a date
8686
date-typer="" | String(Boolean) | false | Set the datepicker to update calendar date when user is typing a date
87+
datepicker-class="" | String('class1 class2 class3') | false | Set custom class/es for the datepicker calendar
8788
datepicker-append-to="" | String('#id','.classname', 'body') | false | Append the datepicker to #id or .class element or to body
8889
datepicker-toggle="" | String(Boolean) | true | Set the datepicker to toggle its visibility on focus and blur
8990

@@ -133,20 +134,13 @@ Sometimes you cannot put date input as a first child of datepicker. In this case
133134
<datepicker date-format="yyyy-MM-dd" selector="form-control">
134135
<div class="input-group">
135136
<input class="form-control" placeholder="Choose a date"/>
136-
<span class="input-group-addon" style="cursor: pointer"><i class="fa fa-lg fa-calendar"></i></span>
137+
<span class="input-group-addon" style="cursor: pointer">
138+
<i class="fa fa-lg fa-calendar"></i>
139+
</span>
137140
</div>
138141
</datepicker>
139142
```
140143

141-
####Datepicker visible on load
142-
You have an option to make the datepicker visible when it loads with `visible-on-load` attribute.
143-
144-
```html
145-
<datepicker visible-on-load>
146-
<input placeholder="Choose a date"/>
147-
</datepicker>
148-
```
149-
150144
### Example
151145

152146
[Live demo](https://720kb.github.io/angular-datepicker)

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<div class="separator50"></div>
2020
<div class="col6 offset-left2">
2121
<div class="col3">
22-
<div datepicker date-set="2011/07/05" date-typer="true">
22+
<div datepicker datepicker-class="test-custom-class" date-set="2011/07/05" date-typer="true">
2323
<input ng-model="date1" type="text" class="angular-datepicker-input"/>
2424
</div>
2525
Date 1 is: {{date1}}

src/js/angular-datepicker.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
, generateHtmlTemplate = function generateHtmlTemplate(prevButton, nextButton) {
117117

118118
var toReturn = [
119-
'<div class="_720kb-datepicker-calendar {{datepickerID}} {{classForToggle}}" ng-blur="hideCalendar()">',
119+
'<div class="_720kb-datepicker-calendar {{datepickerClass}} {{datepickerID}} {{classForToggle}}" ng-blur="hideCalendar()">',
120120
'</div>'
121121
]
122122
, monthAndYearHeader = generateMonthAndYearHeader(prevButton, nextButton)
@@ -727,10 +727,6 @@
727727
angular.element(theCalendar).off('mouseenter mouseleave focusin');
728728
angular.element($window).off('click focus');
729729
});
730-
731-
if (attr.hasOwnProperty('visibleOnLoad')) {
732-
showCalendar();
733-
}
734730
};
735731

736732
return {
@@ -747,7 +743,8 @@
747743
'dateSetHidden': '@',
748744
'dateTyper': '@',
749745
'datepickerAppendTo': '@',
750-
'datepickerToggle': '@'
746+
'datepickerToggle': '@',
747+
'datepickerClass': '@'
751748
},
752749
'link': linkingFunction
753750
};

0 commit comments

Comments
 (0)