From 7ca139af28fbaa6035e5edfced937aa4fc595790 Mon Sep 17 00:00:00 2001 From: Thomas Burleson Date: Wed, 17 Jun 2015 17:25:47 -0500 Subject: [PATCH] fix(utils): update for Angular 1.4.1 compatibility Fixes #3315, Fixes #3325. --- src/core/util/util.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/util/util.js b/src/core/util/util.js index cc7072abfbe..857cee78b11 100644 --- a/src/core/util/util.js +++ b/src/core/util/util.js @@ -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); if (binding.optional && angular.isUndefined(scope[key])) { - var hasKey = attr.hasOwnProperty(attr.$normalize(binding.attrName)); + var attrIsDefined = normalizedAttrName in attr && !angular.isUndefined(attr[normalizedAttrName]); - scope[key] = angular.isDefined(defaults[key]) ? defaults[key] : hasKey; + scope[key] = angular.isDefined(defaults[key]) ? defaults[key] : attrIsDefined; } }); } + }; });