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

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -