另一方面,angular.extend()是一个浅拷贝类似于_.clone
Angular.copy vs Angular.extend
性能明智,我不知道哪个更好,但为了意见,我反对包括库到任何角度应用程序的全局范围(下划线),因为通常这些东西写作angular modules. angular.copy / angular .extend在这种情况下会胜出。
浅/深复制:
Its very simple that if the object has only primitive fields,then obvIoUsly you will go for shallow copy but if the object has references to other objects,then based on the requiement,shallow copy or deep copy should be chosen. What I mean here is,if the references are not modified anytime,then there is no point in going for deep copy. You can just opt shallow copy. But if the references are modified often,then you need to go for deep copy. Again there is no hard and fast rule,it all depends on the requirement.
原文地址:https://www.jb51.cc/angularjs/146091.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。