anduraljs的表格删除和查找关键字
2017-11-21 09:23
337 查看
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style type="text/css">
body {
margin: 0 auto;
width: 500px;
height: 500px;
}
table {
width: 500px;
height: 80px;
}
</style>
<script src="js/angular.min.js"></script>
<script src="js/jquery-2.1.0.js"></script>
<script>
angular.module("myapp", [])
.controller("demo", function($scope) {
$scope.datas = [{
name: "张三",
age: 18,
sex: "男",
happy: "2017 5.25",
caozuo: "删除"
}, {
name: "李三",
age: 18,
sex: "男",
happy: "2017 5.25",
caozuo: "删除"
}, {
name: "王娜",
age: 18,
sex: "女",
happy: "2017 5.25",
caozuo: "删除"
}];
$scope.del=function(i){
alert("是否删除")
$scope.datas.splice(i,1)
alert("删除成功")
}
});
</script>
</head>
<body ng-app="myapp" ng-controller="demo">
<h1 style="text-align: center;">购物车</h1>
<input ng-model="wyq" />
<table border="1">
<thead>
<tr>
<th>姓名</th>
<th>年龄</th>
<th>性别</th>
<th>生日</th>
<th>操作</th>
</tr>
</thead>
<tbody ng-repeat="dat in datas|filter:wyq">
<tr>
<td>{{dat.name}}</td>
<td>{{dat.age}}</td>
<td>{{dat.sex}}</td>
<td>{{dat.happy|date :'yyyy-mm-dd hh:mm:ss'}}</td>
<td><button ng-click="del($index)">{{dat.caozuo}}</button></td>
</tr>
</tbody>
</table>
</body>
</html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style type="text/css">
body {
margin: 0 auto;
width: 500px;
height: 500px;
}
table {
width: 500px;
height: 80px;
}
</style>
<script src="js/angular.min.js"></script>
<script src="js/jquery-2.1.0.js"></script>
<script>
angular.module("myapp", [])
.controller("demo", function($scope) {
$scope.datas = [{
name: "张三",
age: 18,
sex: "男",
happy: "2017 5.25",
caozuo: "删除"
}, {
name: "李三",
age: 18,
sex: "男",
happy: "2017 5.25",
caozuo: "删除"
}, {
name: "王娜",
age: 18,
sex: "女",
happy: "2017 5.25",
caozuo: "删除"
}];
$scope.del=function(i){
alert("是否删除")
$scope.datas.splice(i,1)
alert("删除成功")
}
});
</script>
</head>
<body ng-app="myapp" ng-controller="demo">
<h1 style="text-align: center;">购物车</h1>
<input ng-model="wyq" />
<table border="1">
<thead>
<tr>
<th>姓名</th>
<th>年龄</th>
<th>性别</th>
<th>生日</th>
<th>操作</th>
</tr>
</thead>
<tbody ng-repeat="dat in datas|filter:wyq">
<tr>
<td>{{dat.name}}</td>
<td>{{dat.age}}</td>
<td>{{dat.sex}}</td>
<td>{{dat.happy|date :'yyyy-mm-dd hh:mm:ss'}}</td>
<td><button ng-click="del($index)">{{dat.caozuo}}</button></td>
</tr>
</tbody>
</table>
</body>
</html>
相关文章推荐
- javascript js 删除表格的行、单元列
- HTML angualr js 查找.排序.全选.删除
- JS - Object and Property的删除用法
- Js操作表格-对表格TR的添加/删除/拷贝
- JS-表格数据的添加与删除、搜索
- JS动态添加删除表格行
- 原生js实现查找/添加/删除/指定元素的class
- 使用js实现表格的添加和删除
- js动态添加删除表格行
- js 实现的添加删除表格
- 点滴积累【JS】---JS小功能(操作Table--动态添加删除表格及数据)
- JS实现的表格操作类详解(添加,删除,排序,上移,下移)
- js保留表格标题删除其余行
- 删除行js动态表格之一实现部分(2)
- js 对表格的动态操作(动态添加行,删除该行,在指定位置添加控件)
- js动态生成表格、动态删除一行
- JS实现的表格操作类详解(添加,删除,排序,上移,下移)
- JS操作页面表格内容的添加与删除
- js方法控制html表格的增加和删除