Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 5143656

Browse files
committed
fix(datepicker): fix ngDisabled not working with jQuery.
1 parent 6f43742 commit 5143656

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/components/datepicker/datePicker.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@
135135
/** @final {!angular.JQLite} */
136136
this.$element = $element;
137137

138+
/** @final {!angular.Attributes} */
139+
this.$attrs = $attrs;
140+
138141
/** @final {!angular.Scope} */
139142
this.$scope = $scope;
140143

@@ -243,12 +246,13 @@
243246
DatePickerCtrl.prototype.installPropertyInterceptors = function() {
244247
var self = this;
245248

246-
// Intercept disabled on the date-picker element to disable the internal input.
247-
// This avoids two bindings (outer scope to ctrl, ctrl to input).
248-
Object.defineProperty(this.$element[0], 'disabled', {
249-
get: function() { return self.isDisabled; },
250-
set: angular.bind(self, self.setDisabled)
251-
});
249+
if (this.$attrs['ngDisabled']) {
250+
// The expression is to be evaluated against the directive element's scope and not
251+
// the directive's isolate scope.
252+
this.$element.scope().$watch(this.$attrs['ngDisabled'], function(isDisabled) {
253+
self.setDisabled(isDisabled);
254+
});
255+
}
252256

253257
Object.defineProperty(this, 'placeholder', {
254258
get: function() { return self.inputElement.placeholder; },

0 commit comments

Comments
 (0)