-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
resolve
and locals
overwrite
Objects passed to a function should be considered immutable to avoid unexpected side-effects Closes #2676. Fixes #2614.
- Loading branch information
There are no files selected for viewing
2 comments
on commit bee0523
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.
This does not seem to me to be a good idea. It is now impossible to pass objects by reference to an md-dialog and have that object returned in the md-dialog promise. Have raised a new issue regarding this: #3651
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.
Hi,
I'm not sure why this was changed. I can't pass promise any more to the dialog. But mainly I don't understand why in input should be immutable. For me it should behave as in a directive call. If you don't want to change the object you have to handle the copy yourself before passing to the call, or inside the controller. It's up to the developer. Now you can't do that anymore and you have to implement more complex "callback" function if you want to change the input parameter. I don't think this is the good way to do it.
Thanks.
Maybe using
angular.extend({}, options.resolve/locals || {})
would be the best of both worlds (allowing passing objects by reference and not modifying the original resolve/locals object.