-
Notifications
You must be signed in to change notification settings - Fork 27.4k
BUG: angular.merge breaks some objects #15180
Comments
Angular.merge is known to not support every type of value / object. We actually advise to use more general merge functions, such as thise provided by lodash etc. for general use cases. Angular-chart could make that change. |
So you are saying it is up to angular-chart to fix this?
where the final code will look like this:
|
It's definitely easier to fix it in angular-chart, because they can simply switch to another merge function. In core, we discuss each of the changes to angular.merge individually, because we don't want to blow up the code for this function. |
@Narretz, author of The fix provided by @Doomic seems to add only 3 lines of code and is taken from jQuery merge function which doesn't have this problem. Moreover if it's breaking in my library, it is probably causing other issues as well and should be fixed here. Edit: happy to send a PR if needed. |
The native angular.* helpers are almost notorious for not providing every bit of functionality needed for every library / purpose. |
@jtblin, would |
Sorry for the lag, does |
@jtblin, yes. |
Reading the docs, it doesn't seem to merge but it replaces instead so I don't think that would work:
I'll send a PR as suggested by @Narretz |
@jtblin, yes, if you need to actually merge objects, |
This function has problems with special object types but since it's not used in core, it is not worth implementing fixes for these cases. A general purpose library like lodash (provides `merge`) should be used instead. Closes angular#12653 Closes angular#14941 Closes angular#15180 Closes angular#15992
This function has problems with special object types but since it's not used in core, it is not worth implementing fixes for these cases. A general purpose library like lodash (provides `merge`) should be used instead. Closes angular#12653 Closes angular#14941 Closes angular#15180 Closes angular#15992
I believe this is a bug. The angular merge function will break some objects. I found this issue because of another plugin called Angular-Chart. This plugin build charts (with the use of chartjs) in the angular way.
I posted the issue there, but in depth i believe this is an angular bug.
because the object generated with ctx.createLinearGradient function will be merged like it is an object, but should be treaded as value.
If you want to know the whole issue, you can find it here:
jtblin/angular-chart.js#510
Shortly, the merge function should check if the item is a normal object or a special object to deside if going deeper or just putting the object like a value it the target is the correct way.
bellow how jquery does this check
if more info is needed, please let me know
The text was updated successfully, but these errors were encountered: