angular.js - angular two-way binding problem
为情所困
为情所困 2017-05-15 17:08:13
0
3
592

As shown in the picture, my list and modification are bound to vm.itemObj. If I process it when the pop-up window comes out, it will not be submitted to the backend, because Two-way binding will also change the list. How to solve this

为情所困
为情所困

reply all(3)
Peter_Zhu

Use obj=angular.copy(vm.itemObj) to process the modification in the pop-up window controller. When returning the page controller, re-assign obj to the page controller

小葫芦

One binds vm.itemObj and one binds vm.itemObjCache.

When the modification is confirmed, the value of vm.itemObjCache['xxx'] is overwritten to vm.itemObj['xxx']

迷茫

Using different controllers for pop-ups and lists will avoid this situation.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template