我有一张员工表。我正在使用$ http加载数据,并使用ng-repeat将其打印在网页上。我要编辑每一行的内容。 HTML:
tbody ng-repeat="list in data" >
<tr ng-hide="edit" ng-click="edit=true">
{% verbatim %}
<td> {{$index + 1}}</td>
<td>{{ list.associate_nbr }}</td>
<td>{{ list.per }}%</td>
<td>{{ list.count }}</td>
<td>{{ list.sample_per }}%</td>
<td>{{ list.sample}}</td>
<td><input type="text" value="{{ list.focused
}}"></td>
<td><input type="text" value="{{
list.random_field }}"></td>
</tr>
{% endverbatim %}
MAIN.JS
(function(){
'use strict';
angular.module('sampling.demo',[])
.controller('SamplingController', ['$scope','$http',SamplingController]);
function SamplingController($scope,$http)
{
$scope.data = [];
$http.get('/sample/').then(function(response){
$scope.data = response.data;
});
}
}());
我想在用户单击它时编辑最后两个字段。