Issue
Please help me in order to copy the object into another object using angular 2?
In angular, I used angular.copy() to copy objects to the loose reference of the old objects. But, when I used the same in angular 2 getting below error:
Error: angular is not defined.
Solution
Solution
Angular2 developed on the ground of modern technologies like TypeScript and ES6.
So you can just do let copy = Object.assign({}, myObject)
.
Object assign - nice examples.
For nested objects :
let copy = JSON.parse(JSON.stringify(myObject))
Answered By - Mikki Kobvel
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.