Improve this Doc View Source angular.merge
- function in module ng
This function is deprecated, but will not be removed in the 1.x lifecycle. There are edge cases (see known issues) that are not supported by this function. We suggest using another, similar library for all-purpose merging, such as lodash's merge().
Overview
Deeply extends the destination object dst
by copying own enumerable properties from the src
object(s) to dst
. You can specify multiple src
objects. If you want to preserve original objects, you can do so by passing an empty object as the target: var object = angular.merge({}, object1, object2)
.
Unlike extend(), merge()
recursively descends into object properties of source objects, performing a deep copy.
Known Issues
This is a list of (known) object types that are not handled correctly by this function:
Blob
MediaStream
CanvasGradient
- AngularJS scopes;
angular.merge
also does not support merging objects with circular references.
Usage
angular.merge(dst, src);
Arguments
Param | Type | Details |
---|---|---|
dst | Object | Destination object. |
src | Object | Source object(s). |
Returns
Object |
Reference to |
© 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 3.0.
https://code.angularjs.org/1.8.2/docs/api/ng/function/angular.merge