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

Commit

Permalink
fix(utils): update for Angular 1.4.1 compatibility
Browse files Browse the repository at this point in the history
Fixes #3315, Fixes #3325.
  • Loading branch information
ThomasBurleson committed Jun 17, 2015
1 parent 6315228 commit 7ca139a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/core/util/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Copy link
@gkalpak

gkalpak Jun 18, 2015

Member

I don't think thid is necessary (binding.ATTRNAME is already normalized)

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.

Copy link
@gkalpak

gkalpak Jun 18, 2015

Member

The …in… check is redundant.
And !isUndefined === isDefined.

😞 why change the fine code of the PR ? 😛

This comment has been minimized.

Copy link
@ThomasBurleson

ThomasBurleson Jun 18, 2015

Author Contributor

@gkalpak - I actually did not see that PR until this morning. I will update now...

This comment has been minimized.

Copy link
@gkalpak

gkalpak Jun 18, 2015

Member

👍


scope[key] = angular.isDefined(defaults[key]) ? defaults[key] : hasKey;
scope[key] = angular.isDefined(defaults[key]) ? defaults[key] : attrIsDefined;
}
});
}


};

});
Expand Down

1 comment on commit 7ca139a

@dbwhddn10
Copy link
Contributor

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

Please sign in to comment.