1 Example(s) of angular copy

Description :

angular.copy copy data form one obj to another object, form's object employee copy to another object copy that will be displated in UI. See the code snippet:

angular copy Example - 1
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <title>Welcome to LearnKode - A code learning platform</title>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script>
<body ng-app="app">
    <div ng-controller="copyController">
        <form ng-submit="save(emp)">
            Name: <input type="text" ng-model="emp.name" /><br />
            E-mail: <input type="email" ng-model="emp.email" /><br />
            Gender: <input type="radio" ng-model="emp.gender" value="male" />male
            <input type="radio" ng-model="emp.gender" value="female" />female<br />
        <pre ng-show="emp!=null">form = {{emp}}</pre>
        <pre ng-show="copy!=null">Copy = {{copy | json}}</pre>
    var app = angular.module("app", []);
    app.controller('copyController', ['$scope', function ($scope) {
        $scope.save = function (emp) {
            $scope.copy= angular.copy(emp);