@@ -23,14 +23,17 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
23
23
yearRows : 4
24
24
} )
25
25
26
- . controller ( 'UibDatepickerController' , [ '$scope' , '$attrs' , '$parse' , '$interpolate' , '$locale' , '$log' , 'dateFilter' , 'uibDatepickerConfig' , '$datepickerLiteralWarning' , '$datepickerSuppressError' , 'uibDateParser' ,
27
- function ( $scope , $attrs , $parse , $interpolate , $locale , $log , dateFilter , datepickerConfig , $datepickerLiteralWarning , $datepickerSuppressError , dateParser ) {
26
+ . controller ( 'UibDatepickerController' , [ '$scope' , '$element' , '$ attrs', '$parse' , '$interpolate' , '$locale' , '$log' , 'dateFilter' , 'uibDatepickerConfig' , '$datepickerLiteralWarning' , '$datepickerSuppressError' , 'uibDateParser' ,
27
+ function ( $scope , $element , $ attrs, $parse , $interpolate , $locale , $log , dateFilter , datepickerConfig , $datepickerLiteralWarning , $datepickerSuppressError , dateParser ) {
28
28
var self = this ,
29
29
ngModelCtrl = { $setViewValue : angular . noop } , // nullModelCtrl;
30
30
ngModelOptions = { } ,
31
31
watchListeners = [ ] ,
32
32
optionsUsed = ! ! $attrs . datepickerOptions ;
33
33
34
+ $element . addClass ( 'uib-datepicker' ) ;
35
+ $attrs . $set ( 'role' , 'application' ) ;
36
+
34
37
if ( ! $scope . datepickerOptions ) {
35
38
$scope . datepickerOptions = { } ;
36
39
}
@@ -330,6 +333,12 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
330
333
}
331
334
} ;
332
335
336
+ $element . on ( 'keydown' , function ( evt ) {
337
+ $scope . $apply ( function ( ) {
338
+ $scope . keydown ( evt ) ;
339
+ } ) ;
340
+ } ) ;
341
+
333
342
$scope . $on ( '$destroy' , function ( ) {
334
343
//Clear all watch listeners on destroy
335
344
while ( watchListeners . length ) {
@@ -572,14 +581,14 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
572
581
573
582
. directive ( 'uibDatepicker' , function ( ) {
574
583
return {
575
- replace : true ,
576
584
templateUrl : function ( element , attrs ) {
577
585
return attrs . templateUrl || 'uib/template/datepicker/datepicker.html' ;
578
586
} ,
579
587
scope : {
580
588
datepickerOptions : '=?'
581
589
} ,
582
590
require : [ 'uibDatepicker' , '^ngModel' ] ,
591
+ restrict : 'A' ,
583
592
controller : 'UibDatepickerController' ,
584
593
controllerAs : 'datepicker' ,
585
594
link : function ( scope , element , attrs , ctrls ) {
@@ -592,11 +601,11 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
592
601
593
602
. directive ( 'uibDaypicker' , function ( ) {
594
603
return {
595
- replace : true ,
596
604
templateUrl : function ( element , attrs ) {
597
605
return attrs . templateUrl || 'uib/template/datepicker/day.html' ;
598
606
} ,
599
607
require : [ '^uibDatepicker' , 'uibDaypicker' ] ,
608
+ restrict : 'A' ,
600
609
controller : 'UibDaypickerController' ,
601
610
link : function ( scope , element , attrs , ctrls ) {
602
611
var datepickerCtrl = ctrls [ 0 ] ,
@@ -609,11 +618,11 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
609
618
610
619
. directive ( 'uibMonthpicker' , function ( ) {
611
620
return {
612
- replace : true ,
613
621
templateUrl : function ( element , attrs ) {
614
622
return attrs . templateUrl || 'uib/template/datepicker/month.html' ;
615
623
} ,
616
624
require : [ '^uibDatepicker' , 'uibMonthpicker' ] ,
625
+ restrict : 'A' ,
617
626
controller : 'UibMonthpickerController' ,
618
627
link : function ( scope , element , attrs , ctrls ) {
619
628
var datepickerCtrl = ctrls [ 0 ] ,
@@ -626,11 +635,11 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
626
635
627
636
. directive ( 'uibYearpicker' , function ( ) {
628
637
return {
629
- replace : true ,
630
638
templateUrl : function ( element , attrs ) {
631
639
return attrs . templateUrl || 'uib/template/datepicker/year.html' ;
632
640
} ,
633
641
require : [ '^uibDatepicker' , 'uibYearpicker' ] ,
642
+ restrict : 'A' ,
634
643
controller : 'UibYearpickerController' ,
635
644
link : function ( scope , element , attrs , ctrls ) {
636
645
var ctrl = ctrls [ 0 ] ;
0 commit comments