$scope.del=function(obj){ //删除
$scope.tt.splice(obj,1);
}
$scope.Xuan=function(){ //全选
for(var i=0;i<$scope.tt.length;i++){
$scope.tt[i].st=$scope.xuan;
}
}
$scope.update=function(){ //选中删除
for(var i=0;i<$scope.tt.length;i++){
if($scope.tt[i].st==true){
$scope.tt.splice(i,1);
i--; }
}
}
//左加右减
<td><button ng-click="count($index,-1)">-</button><input type="text" ng-model="t.shuliang" style="width: 30px;"/>
<button ng-click="count($index,+1)">+</button></td>
$scope.count = function(index, n) {
$scope.tt[index].shuliang = $scope.tt[index].shuliang + n;
if($scope.tt[index].shuliang <= 0) {
$scope.tt.splice(index, 1);
}
}
//总和
$scope.sum = function() {
var aa = 0;
for(var i = 0; i < $scope.tt.length; i++) {
aa += $scope.tt[i].jiage *$scope.tt[i].shuliang;
}
return aa;
}
//修改
<buttonng-click="f=true">修改</button>
<td>
{{t.city}}
<inputng-model="t.city"ng-show="f"/>
<inputtype="button"value="保存"ng-show="f"ng-click="f=false"/>
</td>
//修改
<buttonng-click="f=true">修改</button>
<td>
{{t.city}}
<inputng-model="t.city"ng-show="f"/>
<inputtype="button"value="保存"ng-show="f"ng-click="f=false"/>
</td>
//模糊查询 排序
<trng-repeat="t in tt|filter:{yonghu:uname,shouji:uhao,city:cheng,tai:zhuang}|orderBy:px"ng-show="shijian(t.date1)">
<selectng-model="px"style="width: 90px;">
<optionvalue=""selected="selected">排序</option>
<optionvalue="-idd">从大到小</option>
<optionvalue="+idd">从小到大</option>
</select>