mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
AngularJS: Genericised angular.copy and added JSDoc
This commit is contained in:
@@ -569,3 +569,34 @@ angular.module('docsTabsExample', [])
|
||||
templateUrl: 'my-pane.html'
|
||||
};
|
||||
});
|
||||
|
||||
interface copyExampleUser {
|
||||
name?: string;
|
||||
email?: string;
|
||||
gender?: string;
|
||||
}
|
||||
|
||||
interface copyExampleScope {
|
||||
|
||||
user: copyExampleUser;
|
||||
master: copyExampleUser;
|
||||
update: (copyExampleUser) => any;
|
||||
reset: () => any;
|
||||
}
|
||||
|
||||
angular.module('copyExample', [])
|
||||
.controller('ExampleController', ['$scope', function ($scope: copyExampleScope) {
|
||||
$scope.master = { };
|
||||
|
||||
$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();
|
||||
}]);
|
||||
Reference in New Issue
Block a user