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

fix($mdUtil): make "initOptionalProperties" compatible with angular >= 1.4.1 #3316

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/core/util/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,15 +334,14 @@ angular.module('material.core')
},

/**
* Give optional properties with no value a boolean true by default
* Give optional properties with no value a boolean true if attr provided or false otherwise
*/
initOptionalProperties: function (scope, attr, defaults ) {
defaults = defaults || { };
angular.forEach(scope.$$isolateBindings, function (binding, key) {
if (binding.optional && angular.isUndefined(scope[key])) {
var hasKey = attr.hasOwnProperty(attr.$normalize(binding.attrName));

scope[key] = angular.isDefined(defaults[key]) ? defaults[key] : hasKey;
var attrIsDefined = angular.isDefined(attr[binding.attrName]);
scope[key] = angular.isDefined(defaults[key]) ? defaults[key] : attrIsDefined;
}
});
}
Expand Down