The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

angular.copy

angular.copy

3:09
In this episode John takes a look at `angular.copy` and how you can use it for non-destructive form editing. Instead of binding to a value directly, we make a deep copy of that object and bind to the copy for presentation. Updates to the data are then "saved" to the original object to persist changes.
Watch this lesson now
Avatar
egghead.io

In this episode John takes a look at angular.copy and how you can use it for non-destructive form editing. Instead of binding to a value directly, we make a deep copy of that object and bind to the copy for presentation. Updates to the data are then "saved" to the original object to persist changes.

Avatar
Dmitri

Hi John. How does angular.copy compare to the lodash _.clone, for example? Would you recommend lodash utility functions over the built-in angular ones?

Avatar
Joel

Dmitri, I'm always going to prefer lodash if it is in my project as a dependency already (and it always is ;)). The angular methods exist so that angular doesn't need a dependency, and are fine. I just like to be consistent, so _ wins!

In reply to Dmitri
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?