angular2: how to copy object into another object

后端 未结 8 672
失恋的感觉
失恋的感觉 2021-01-30 10:05

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 object

相关标签:
8条回答
  • 2021-01-30 10:52

    You can do in this in Angular with ECMAScript6 by using the spread operator:

    let copy = {...myObject};
    
    0 讨论(0)
  • 2021-01-30 10:54

    Loadsh is the universal standard library for coping any object deepcopy. It's a recursive algorithm. It's check everything and does copy for the given object. Writing this kind of algorithm will take longer time. It's better to leverage the same.

    0 讨论(0)
提交回复
热议问题