What's alternative to angular.copy in Angular

后端 未结 15 1167
忘掉有多难
忘掉有多难 2020-11-29 00:43

How can I copy an object and lose its reference in Angular?

With AngularJS, I can use angular.copy(object), but I\'m getting some error using that in An

15条回答
  •  Happy的楠姐
    2020-11-29 01:33

    I as well as you faced a problem of work angular.copy and angular.expect because they do not copy the object or create the object without adding some dependencies. My solution was this:

      copyFactory = (() ->
        resource = ->
          resource.__super__.constructor.apply this, arguments
          return
        this.extendTo resource
        resource
      ).call(factory)
    

提交回复
热议问题