angular.copy

Improve this Doc View Source angular.copy

  1. function in module ng

Creates a deep copy of source, which should be an object or an array.

  • If no destination is supplied, a copy of the object or array is created.
  • If a destination is provided, all of its elements (for arrays) or properties (for objects) are deleted and then all elements/properties from the source are copied to it.
  • If source is not an object or array (inc. null and undefined), source is returned.
  • If source is identical to 'destination' an exception will be thrown.

Usage

angular.copy(source, [destination]);

Arguments

Param Type Details
source *

The source that will be used to make a copy. Can be any type, including primitives, null, and undefined.

destination
(optional)
ObjectArray

Destination into which the source is copied. If provided, must be of the same type as source.

Returns

*

The copy or updated destination, if destination was specified.

© 2010–2016 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://code.angularjs.org/1.3.20/docs/api/ng/function/angular.copy

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部