01.
angular.module(
'test'
, []).controller(
'testApp'
,
function
($scope){
02.
03.
04.
$scope.itemsList = [];
05.
$scope.add =
function
(){
06.
$scope.itemsList.push({
'name'
:
''
,
'mobile'
:
''
,
'sex'
:
''
});
07.
};
08.
$scope.cancel =
function
(index){
09.
$scope.itemsList.splice(index, 1);
10.
};
11.
$scope.cancelAll =
function
(){
12.
$scope.itemsList = [];
13.
};
14.
$scope.copy =
function
(index){
15.
$scope.itemsList.push({
'name'
: $scope.itemsList[index].name
16.
,
'mobile'
: $scope.itemsList[index].mobile
17.
,
'sex'
: $scope.itemsList[index].sex});
18.
};
19.
$scope.showValue =
function
($item){
20.
alert(
"name: "
+ $item.name +
"\n"
+
21.
"mobile: "
+ $item.mobile +
"\n"
+
22.
"sex: "
+ $item.sex
23.
);
24.
};
25.
});