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

Commit 7ca139a

Browse files
fix(utils): update for Angular 1.4.1 compatibility
Fixes #3315, Fixes #3325.
1 parent 6315228 commit 7ca139a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/core/util/util.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,19 +334,21 @@ angular.module('material.core')
334334
},
335335

336336
/**
337-
* Give optional properties with no value a boolean true by default
337+
* Give optional properties with no value a boolean true if attr provided or false otherwise
338338
*/
339339
initOptionalProperties: function (scope, attr, defaults ) {
340340
defaults = defaults || { };
341341
angular.forEach(scope.$$isolateBindings, function (binding, key) {
342+
var normalizedAttrName = attr.$normalize(binding.attrName);
342343
if (binding.optional && angular.isUndefined(scope[key])) {
343-
var hasKey = attr.hasOwnProperty(attr.$normalize(binding.attrName));
344+
var attrIsDefined = normalizedAttrName in attr && !angular.isUndefined(attr[normalizedAttrName]);
344345

345-
scope[key] = angular.isDefined(defaults[key]) ? defaults[key] : hasKey;
346+
scope[key] = angular.isDefined(defaults[key]) ? defaults[key] : attrIsDefined;
346347
}
347348
});
348349
}
349350

351+
350352
};
351353

352354
});

0 commit comments

Comments
 (0)