angular - Copy values of objects without binding them -
i'd copy copy values of object (item) 1 (editeditem) put form , modify while original object still displayed unchanged.
<a (click)="editeditem=item">edit</a>
with approach 2 objects bound, item changes when editeditem modified. there way copy values without binding objects?
you can use json.parse(json.stringify()) if don't care types.
here example:
html
<a (click)="copy()">edit</a>
ts
copy() { this.editeditem = json.parse(json.stringify(this.item)) }
Comments
Post a Comment