$scope.records = [];
// 生成随机数方法:
function S4()
{
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}
function newobj() {
var obj = {
"id":S4(),
"amount":$scope.amount,
"bounty":$scope.bounty
}
return obj;
}
//数组中放入一个对象, 试表格tbody中有一行
$scope.records.push(newobj());
//新增一行
$scope.adddetails1 = function(){
console.log("添加")
$scope.records.push(newobj());
}
//删除一行,根据id来删除
$scope.deldetails1 = function(row){
for(var r in $scope.records){
if($scope.records[r].id==row.id)
{
$scope.records.splice(r,1);
}
}
console.log(row);
}