Meta charset="UTF-8">
@H_403_8@
var app=angular.module("myapp",[]);
app.controller("myCtrl",function($scope){
$scope.h=false;//显示和隐藏添加列表
$scope.persons=[];//存放添加的内容
$scope.xz=function(){//新增球员的点击事件点击列表出现
$scope.h=true;
}
$scope.tj = function(){
for(var i=0;i<$scope.persons.length;i++){//遍历列表的所有数据
if($scope.name==$scope.persons[i].name) {//对比数据没有重复的姓名出现
alert("您记录的内容已存在");
return;
}
}
//判断不能为空
if($scope.name!=""&&$scope.name!=null){
if($scope.wz!=""&&$scope.wz!=null){
if($scope.hao!=""&&$scope.hao!=null){
if($scope.number!=""&&$scope.number!=null){
$scope.persons.push({//添加
name:$scope.name,wz:$scope.wz,hao:$scope.hao,number:$scope.number});
$scope.name="";
$scope.wz="";
$scope.hao="";
$scope.number="";
$scope.h=false;//添加成功添加表格关闭
}else{
alert("票數不能為空");
}
}else{
alert("球号不能为空");
}
}else{
alert("位置不能为空");
}
}else{
alert("姓名不能为空");
}
}
});
查询