0
最初は、ng-tableの行があり、addrowボタンをクリックしたときに追加の行を1つ追加する必要があります。その行べきは、入力ボックス、またその行がなければならない含まのみ..ng-tableに新しい行を動的に追加して、その行が4つの入力ボックスを保持する方法
最初は、ng-tableの行があり、addrowボタンをクリックしたときに追加の行を1つ追加する必要があります。その行べきは、入力ボックス、またその行がなければならない含まのみ..ng-tableに新しい行を動的に追加して、その行が4つの入力ボックスを保持する方法
テーブルそのNGテーブルに属するuは参照用https://plnkr.co/edit/vOYNz80UAaDaFq2VImfU?p=preview
をインクリメントするための追加の行をクリックしながら、Uは、一個の以上のオブジェクトをプッシュすることができHTML
<button ng-click="addrow()">Add Row</button>
<table ng-table="vm.tableParams" class="table" >
<thead>
<th> Firstname </th>
<th> Lasttname </th>
</thead>
<tr ng-repeat="user in users">
<td title="'Name'" >
<input ng-model="user.first_name" /></td>
<td title="'Age'" >
<input ng-model="user.last_name" />
</td>
</tr>
</table>
JS
$scope.users = [{
"id": 1,
"first_name": "Philip",
"last_name": "Kim",
"email": "[email protected]",
"country": "Indonesia",
"ip_address": "29.107.35.8"
}, {
"id": 2,
"first_name": "Judith",
"last_name": "Austin",
"email": "[email protected]",
"country": "China",
"ip_address": "173.65.94.30"
}, {
"id": 3,
"first_name": "Julie",
"last_name": "Wells",
"email": "[email protected]",
"country": "Finland",
"ip_address": "9.100.80.145"
}, {
"id": 4,
"first_name": "Gloria",
"last_name": "Greene",
"email": "[email protected]",
"country": "Indonesia",
"ip_address": "69.115.85.157"
}, {
"id": 50,
"first_name": "Andrea",
"last_name": "Greene",
"email": "[email protected]",
"country": "Russia",
"ip_address": "128.72.13.52"
}];
$scope.addrow = function() {
var obj = {
"id": "",
"first_name": "",
"last_name": "",
"email": "",
"country": "",
"ip_address": ""
}
$scope.users.push(obj)
}
くださいWRIいくつかのコード。 – katmanco