docs(angular.copy): update example to use a module

This commit is contained in:
Brian Ford
2014-07-07 23:56:26 -07:00
parent 7279452898
commit 282ed94cf9

View File

@@ -721,9 +721,9 @@ function isLeafNode (node) {
* @returns {*} The copy or updated `destination`, if `destination` was specified.
*
* @example
<example>
<example module="copyExample">
<file name="index.html">
<div ng-controller="Controller">
<div ng-controller="ExampleController">
<form novalidate class="simple-form">
Name: <input type="text" ng-model="user.name" /><br />
E-mail: <input type="email" ng-model="user.email" /><br />
@@ -737,21 +737,22 @@ function isLeafNode (node) {
</div>
<script>
function Controller($scope) {
$scope.master= {};
angular.module('copyExample')
.controller('ExampleController', ['$scope', function($scope) {
$scope.master= {};
$scope.update = function(user) {
// Example with 1 argument
$scope.master= angular.copy(user);
};
$scope.update = function(user) {
// Example with 1 argument
$scope.master= angular.copy(user);
};
$scope.reset = function() {
// Example with 2 arguments
angular.copy($scope.master, $scope.user);
};
$scope.reset = function() {
// Example with 2 arguments
angular.copy($scope.master, $scope.user);
};
$scope.reset();
}
$scope.reset();
}]);
</script>
</file>
</example>