Skip to content

This Fixes #85 'angular.merge is not a function .controller' #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 16, 2015

Conversation

dtaylor113
Copy link
Member

No description provided.

@waldenraines
Copy link

Need some tests for pfUtils.

@waldenraines
Copy link

Also, why don't we just use angular.extend() instead of angular.merge()?

@jeff-phillips-18
Copy link
Member

The extendDeep copy does not clone the second argument's (defaultConfig) fields when copying to the dst object. This causes the defaultConfig to be modified if the dest object is modified for fields that are objects or arrays.

@dtaylor113
Copy link
Member Author

"Also, why don't we just use angular.extend() instead of angular.merge()?"

angular.extend() doesn't do a deep copy.

@dtaylor113
Copy link
Member Author

"Need some tests for pfUtils."
There chart and view objects which use pfUtils do have unit tests which verify pfUtils is working correctly.

@waldenraines
Copy link

There chart and view objects which use pfUtils do have unit tests which verify pfUtils is working correctly.

No they don't, they verify that angular.merge() is working correctly (or in the case of 1.3, _.merge). If we're going to keep this approach it needs to be tested, especially this new extendDeep() function.

In dev mode, I commented out the other choices so that 'extendDeep()' was being used. All unit tests and ng-doc examples ran successfully, but I agree this is not enough of a test. I am working on unit tests for this. -thanks

@waldenraines
Copy link

angular.extend() doesn't do a deep copy.

Then what about _.extend()? Since we're requiring underscore can't we just use that and get rid of the need for pfUtils?

@dtaylor113
Copy link
Member Author

Underscore extend is a shallow copy, we need a deep copy. pfUtils is need for those customers who are < angular-js 1.4 and are using underscore (not lodash). In this case, we need to make our own 'extendDeep' function.


angular.module('patternfly.utils').constant('pfUtils', {
combine: function (source1, source2) {
var retValue;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer to see this called merge but otherwise LGTM

@waldenraines
Copy link

Underscore extend is a shallow copy, we need a deep copy. pfUtils is need for those customers who are < angular-js 1.4 and are using underscore (not lodash). In this case, we need to make our own 'extendDeep' function.

How long will we support < angular 1.4? Should we file an issue to get rid of pfUtils at some point in the future? I don't think we want to support this indefinitely and it introduces extra dependencies that will not be needed once people upgrade.

@dtaylor113 dtaylor113 force-pushed the issue85 branch 2 times, most recently from 3c13028 to 3aad6e6 Compare September 16, 2015 16:46
@dtaylor113
Copy link
Member Author

Hi, I believe my latest push addressed all issues.
If so, @jeff-phillips-18 please merge
-thanks

@dtaylor113
Copy link
Member Author

Hi @jeff-phillips-18, latest push address you last comment -thanks

jeff-phillips-18 added a commit that referenced this pull request Sep 16, 2015
This Fixes #85  'angular.merge is not a function .controller'
@jeff-phillips-18 jeff-phillips-18 merged commit 99780f5 into patternfly:master Sep 16, 2015
@dtaylor113 dtaylor113 deleted the issue85 branch September 17, 2015 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants