<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0,
minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes" />
<title></title>
<script type="text/javascript" src="js/angular.min.js" ></script>
<script type="text/javascript" src="js/jquery-3.2.1.min.js" ></script>
<script type="text/javascript">
var app = angular.module("myApp",[]);
app.controller("myCtrl",function($scope){
$scope.goods = [
{"id":"201","name":"MacPro","age":10000,"iphone":"蒙牛","rq":"2017-01-22" },
{"id":"202","name":"iPhoneX","age":8000,"iphone":"老北京","rq":"2018-02-12" },
{"id":"203","name":"小米7","age":4999,"iphone":"麒麟","rq":"2019-03-13" },
{"id":"204","name":"华为P10","age":2999,"iphone":"百事","rq":"2020-04-29" }];
//过滤条件
$scope.searchKey;
$scope.deleteMore=function(){
var arr = $(":checkbox:checked")
if(arr.length>0){
if(confirm("您确定要删除吗?")){
arr.each(function(){
var _id = $(this).prop("title");
for (g in $scope.goods) {
if($scope.goods[g].id==_id){
$scope.goods.splice(g,1)
}
}
})
}
}else{
alert("请您勾选数据!")
}
}
})
</script>
<style type="text/css">
table{
text-align: center;
}
.red{
background-color:#33FFFF;
}
.green{
background-color: #CC9966;
}
</style>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
<input style="background-color: yellow; border-radius: 15px; " placeholder="根据日期搜索" type="text" ng-model="loginDataSelect" />
<br />
<br />
<table width="400px" border="1px" bordercolor="red" cellpadding="1px" cellspacing="1px" >
<tr style="background-color: grey;">
<td>姓名</td>
<td>年龄</td>
<td>电话</td>
<td><select ng-model="DataPaixu"><option ></option><option value="rq">注册日期正序</option><option value="-rq">注册日期倒序</option></select></td>
<td></td>
</tr>
<tr ng-repeat="g in goods | filter:{rq:loginDataSelect }| orderBy:DataPaixu" class="{{$index%2==0?'red':'green'}}">
<td>{{g.name}}</td>
<td>{{g.age}}</td>
<td>{{g.iphone}}</td>
<td>{{g.rq}}</td>
<td><input type="checkbox" value="{{g.id}}" ng-model="checkall" title="{{g.id}}" /></td>
</tr>
</table>
<input style="text-align: right;" type="button" value="批量删除" ng-click="deleteMore();"/>
<input type="button" οnclick="javascrtpt:window.location.href='index2.html'" value="下一页" style="background-color: #0000FF;width: 200px;height: 50px;border-radius: 10px;"/>
</body>
</html>