diff --git a/src/datepicker/datepicker.js b/src/datepicker/datepicker.js index 91237005c3..0d9d078294 100644 --- a/src/datepicker/datepicker.js +++ b/src/datepicker/datepicker.js @@ -266,9 +266,12 @@ function ($compile, $parse, $document, $position, dateFilter, datepickerPopupCon restrict: 'EA', require: 'ngModel', link: function(originalScope, element, attrs, ngModel) { - - var closeOnDateSelection = angular.isDefined(attrs.closeOnDateSelection) ? scope.$eval(attrs.closeOnDateSelection) : datepickerPopupConfig.closeOnDateSelection; - var dateFormat = attrs.datepickerPopup || datepickerPopupConfig.dateFormat; + var closeOnDateSelection = angular.isDefined(attrs.closeOnDateSelection) ? originalScope.$eval(attrs.closeOnDateSelection) : datepickerPopupConfig.closeOnDateSelection; + var dateFormat; + attrs.$observe('datepickerPopup', function(value) { + dateFormat = value || datepickerPopupConfig.dateFormat; + ngModel.$render(); + }); // create a child scope for the datepicker directive so we are not polluting original scope var scope = originalScope.$new(); diff --git a/src/datepicker/docs/demo.html b/src/datepicker/docs/demo.html index 22404d030e..37c891759a 100644 --- a/src/datepicker/docs/demo.html +++ b/src/datepicker/docs/demo.html @@ -1,13 +1,18 @@
Selected date is: {{dt | date:'fullDate' }}-
+ + +
+Format options: