AngularJS : copy vs extend

后端 未结 4 1871
清歌不尽
清歌不尽 2021-01-13 23:27

Explanation :

we come across some situation in which we need to copy one object to another object. In that case, we probably have two solutions: ang

4条回答
  •  南笙
    南笙 (楼主)
    2021-01-13 23:56

    agular.copy clones (deep copy) an object and creates a new object using the same values, while angular.extend does a shallow copy so that the attributes refer to same values in memory. A very nice explanation is given here which differentiates very well between .copy(), .extend() and .merge() methods

提交回复
热议问题