angularjs - extend recursive

前端 未结 6 1528
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-10 10:59

I would like to extend some properties recursive (aka. deep copy). much like jQuery does. I\'m not including jquery only b/c of one thing.

jQuery.extend( tru         


        
6条回答
  •  囚心锁ツ
    2020-12-10 11:34

    All the answers here are valid for versions of Angular before 1.4

    As of Angular 1.4, you can use angular.merge to do exactly that:

    Unlike extend(), merge() recursively descends into object properties of source objects, performing a deep copy.

    https://docs.angularjs.org/api/ng/function/angular.merge

提交回复
热议问题