Skip to content

Commit

Permalink
fix(datepicker): fix ngDisabled not working with jQuery.
Browse files Browse the repository at this point in the history
  • Loading branch information
jelbourn authored and kennethcachia committed Sep 23, 2015
1 parent f45c561 commit 91dc702
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/components/datepicker/datePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@
/** @final {!angular.JQLite} */
this.$element = $element;

/** @final {!angular.Attributes} */
this.$attrs = $attrs;

/** @final {!angular.Scope} */
this.$scope = $scope;

Expand Down Expand Up @@ -243,12 +246,13 @@
DatePickerCtrl.prototype.installPropertyInterceptors = function() {
var self = this;

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

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

0 comments on commit 91dc702

Please sign in to comment.