* problem : Modify data in form , It is often encountered that the data of the table is also modified , And whether or not you press the OK or cancel button , The data of the table has been modified .
- Some codes are as follows : editRow(row: any): void { this.currentInfo = row; this.dialogVisible
= true; this.title = ' Update information '; }
- Cause of the problem :
this.currentInfo = row;

In this code ,row yes Object object type , If you assign directly , It becomes a shallow copy , The copied address , When the value is changed in the form table The data in is changing , So we need to make a deep copy .

- Solution : utilize JSON Make a deep copy
editRow(row: any): void { this.currentInfo = JSON.parse(JSON.stringify(row));
this.dialogVisible = true; this.title = ' Update information '; }
-PS:js There are two different data types in , One is the basic type , One is the reference type , among Object Is a reference type ( What we use here is typescript, Principle and js identical )

Technology
©2019-2020 Toolsou All rights reserved,
html Writing about cherry trees , Writing about cherry trees It's unexpected Python Cherry tree (turtle The gorgeous style of Library ) Browser kernel ( understand )HashMap Explain in detail java Four functional interfaces ( a key , simple )os Simple use of module Some East 14 Pay change 16 salary , Sincerity or routine ?