【文件属性】:
文件名称:AngularJS API之copy深拷贝详解及实例
文件大小:186KB
文件格式:PDF
更新时间:2020-11-26 01:31:04
angular api ar
angular提供了一个可以复制对象的api——copy(source,destination),它会对source对象执行深拷贝。
使用时需要注意下面几点:
如果只有一个参数(没有指定拷贝的对象),则返回一个拷贝对象
如果指定了destination,则会深拷贝对象复制给destination
如果source是null或者undefined,那么会直接返回source
如果source就是desitination,那么会报错。
下面看看使用样例:
<html>
<head>
<meta http-equiv="Content-Type" content="text