Created
June 4, 2015 07:42
-
-
Save sushantdhiman/0b1957bfb096c1addccf to your computer and use it in GitHub Desktop.
Bootstrap.UI Date Picker Angular Addon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Just Add this addon on parent or same level of datepicker-ui. | |
current-date will automatically be updated with date selected by keyboard | |
*/ | |
/** Enhance the ui.datepicker to able to read the selected date from ui.datepicker **/ | |
angular.module('directives.',['ui.bootstrap.datepicker']) | |
.directive('ariaAddon',['$timeout',function($timeout){ | |
return { | |
restrict : 'A', | |
scope : { | |
'currentDate' : "=" | |
}, | |
link:function(scope, elm, attrs){ | |
$timeout(function(){ | |
var popup = elm.find('[datepicker]'); | |
var datepickerController = angular.element(popup).controller('datepicker'); | |
var datepickerScope = angular.element(popup).isolateScope(); | |
datepickerScope.$watch(function(){ | |
return datepickerController.activeDate; | |
},function(newValue,oldValue){ | |
scope.currentDate = oldValue; | |
}) | |
},0); | |
} | |
}; | |
}]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment