Angular ให้ API ที่สามารถคัดลอกวัตถุ - คัดลอก (แหล่งที่มาปลายทาง) ซึ่งจะทำการคัดลอกลึกของวัตถุต้นทาง
ประเด็นต่อไปนี้ควรให้ความสนใจเมื่อใช้:
มาดูตัวอย่างการใช้:
<html> <head> <meta http-equiv = "content-type" content = "text/html; charset = utf-8"/> <script src = "http://apps.bdimg.com/libs/angular.js/1.2.16/angular.min.min.min.min.min.min.min.min.min.min.min.min.min.min.min.min.min.min.min.js <div ng-controller = "ExampleController"> <ฟอร์ม novalidate> ชื่อ: <อินพุตประเภท = "ข้อความ" ng-model = "user.name" /> <br /> e-mail: <อินพุต type = "อีเมล" ng-model = "user.email" /> <br /> เพศ type = "Radio" ng-model = "user.gender" value = "female"/> หญิง <br/> <button ng-click = "รีเซ็ต ()"> รีเซ็ต </button> <button ng-click = "update (user)"> บันทึก </button> </form> JSON}} </pre> <pre> master = {{master | JSON}} </pre> </div> <script> angular.module ('copyExample', []). controller ('ExampleController', ['$ scope', ฟังก์ชั่น ($ scope) {$ scope.master = {}; var test1; console.log (angular.copy console.log (Angular.copy (test2)); // undefined var test2 = "A"; Angular.copy ($ scope.master, $ scope.user); </script> </body> </html>ข้างต้นเป็นการรวบรวมข้อมูลของสำเนาของ AngularJS API เราจะยังคงเพิ่มข้อมูลที่เกี่ยวข้องในอนาคต ขอบคุณสำหรับการสนับสนุนเว็บไซต์นี้!