Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit 1fbcb5d

Browse files
committed
fix(datepicker): remove edge case position updates
Closes #1296
1 parent 48955d6 commit 1fbcb5d

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

src/datepicker/datepicker.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -381,22 +381,16 @@ function ($compile, $parse, $document, $position, dateFilter, datepickerPopupCon
381381

382382
element.bind('input change keyup', function() {
383383
scope.$apply(function() {
384-
updateCalendar();
384+
scope.date = ngModel.$modelValue;
385385
});
386386
});
387387

388388
// Outter change
389389
ngModel.$render = function() {
390390
var date = ngModel.$viewValue ? dateFilter(ngModel.$viewValue, dateFormat) : '';
391391
element.val(date);
392-
393-
updateCalendar();
394-
};
395-
396-
function updateCalendar() {
397392
scope.date = ngModel.$modelValue;
398-
updatePosition();
399-
}
393+
};
400394

401395
function addWatchableAttribute(attribute, scopeProperty, datepickerAttribute) {
402396
if (attribute) {

src/datepicker/docs/demo.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
<pre>Selected date is: <em>{{dt | date:'fullDate' }}</em></pre>
33

44
<h4>Inline</h4>
5-
<div class="well well-small" ng-model="dt" style="display:inline-block;">
6-
<datepicker min="minDate" show-weeks="showWeeks"></datepicker>
5+
<div style="display:inline-block; min-height:290px;">
6+
<div class="well well-small" ng-model="dt">
7+
<datepicker min="minDate" show-weeks="showWeeks"></datepicker>
8+
</div>
79
</div>
810

911
<h4>Popup</h4>
1012
<div class="form-horizontal">
1113
<p>
1214
<input type="text" datepicker-popup="{{format}}" ng-model="dt" is-open="opened" min="minDate" max="'2015-06-22'" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" ng-required="true" close-text="Close" />
13-
<button class="btn" ng-click="open()"><i class="icon-calendar"></i></button>
15+
<button class="btn" ng-click="open($event)"><i class="icon-calendar"></i></button>
1416
</p>
1517
<p><i>Format options:</i> <select ng-model="format" ng-options="f for f in formats"><option></option></select></p>
1618
</div>

src/datepicker/docs/demo.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var DatepickerDemoCtrl = function ($scope, $timeout) {
1+
var DatepickerDemoCtrl = function ($scope) {
22
$scope.today = function() {
33
$scope.dt = new Date();
44
};
@@ -23,10 +23,11 @@ var DatepickerDemoCtrl = function ($scope, $timeout) {
2323
};
2424
$scope.toggleMin();
2525

26-
$scope.open = function() {
27-
$timeout(function() {
28-
$scope.opened = true;
29-
});
26+
$scope.open = function($event) {
27+
$event.preventDefault();
28+
$event.stopPropagation();
29+
30+
$scope.opened = true;
3031
};
3132

3233
$scope.dateOptions = {

0 commit comments

Comments
 (0)