-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -334,19 +334,21 @@ 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) { | ||
var normalizedAttrName = attr.$normalize(binding.attrName); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
if (binding.optional && angular.isUndefined(scope[key])) { | ||
var hasKey = attr.hasOwnProperty(attr.$normalize(binding.attrName)); | ||
var attrIsDefined = normalizedAttrName in attr && !angular.isUndefined(attr[normalizedAttrName]); | ||
This comment has been minimized.
Sorry, something went wrong.
gkalpak
Member
|
||
|
||
scope[key] = angular.isDefined(defaults[key]) ? defaults[key] : hasKey; | ||
scope[key] = angular.isDefined(defaults[key]) ? defaults[key] : attrIsDefined; | ||
} | ||
}); | ||
} | ||
|
||
|
||
}; | ||
|
||
}); | ||
|
1 comment
on commit 7ca139a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ThomasBurleson initOptionalProperties method is still problem in 1.4.x with bindTocontroller: true directive option
the difference is scope.$$isolateBindings is empty in 1.4.x with bindToController: true
1.3.x http://plnkr.co/edit/Tuobbl
1.4.x http://plnkr.co/edit/7Y9ZsI
I don't think thid is necessary (
binding.ATTRNAME
is already normalized)