Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 282ed94

Browse files
committed
docs(angular.copy): update example to use a module
1 parent 7279452 commit 282ed94

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

src/Angular.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -721,9 +721,9 @@ function isLeafNode (node) {
721721
* @returns {*} The copy or updated `destination`, if `destination` was specified.
722722
*
723723
* @example
724-
<example>
724+
<example module="copyExample">
725725
<file name="index.html">
726-
<div ng-controller="Controller">
726+
<div ng-controller="ExampleController">
727727
<form novalidate class="simple-form">
728728
Name: <input type="text" ng-model="user.name" /><br />
729729
E-mail: <input type="email" ng-model="user.email" /><br />
@@ -737,21 +737,22 @@ function isLeafNode (node) {
737737
</div>
738738
739739
<script>
740-
function Controller($scope) {
741-
$scope.master= {};
740+
angular.module('copyExample')
741+
.controller('ExampleController', ['$scope', function($scope) {
742+
$scope.master= {};
742743
743-
$scope.update = function(user) {
744-
// Example with 1 argument
745-
$scope.master= angular.copy(user);
746-
};
744+
$scope.update = function(user) {
745+
// Example with 1 argument
746+
$scope.master= angular.copy(user);
747+
};
747748
748-
$scope.reset = function() {
749-
// Example with 2 arguments
750-
angular.copy($scope.master, $scope.user);
751-
};
749+
$scope.reset = function() {
750+
// Example with 2 arguments
751+
angular.copy($scope.master, $scope.user);
752+
};
752753
753-
$scope.reset();
754-
}
754+
$scope.reset();
755+
}]);
755756
</script>
756757
</file>
757758
</example>

0 commit comments

Comments
 (0)