angularjs表行编辑问题

时间:2015-11-26 21:43:04

标签: angularjs

我正在尝试编辑表格中的一行数据。当我点击该行时,它会弹出所需的视图,但无法提取相关数据进行编辑。任何人都可以尝试找到问题。我猜它与$ routeParams和表行的相关索引有关。添加了我的plunker。



# Current time -3 months:
$Threshold = (Get-Date).AddMonths(-3).ToFileTime()

# Retrieve the users
Get-ADUser -LDAPFilter "(&(lastlogontimestamp < $Threshold))"
&#13;
&#13;
&#13;

http://plnkr.co/edit/ez0s66S9bmO0jt8Nb6BR?p=info

1 个答案:

答案 0 :(得分:0)

你几乎得到了......这是一个错字:

  function($scope, $location, $routePartam, listService) {

见?它代替$routePartam$routeParams,因此您的editController代码可能是这样的,请检查第一行:

  function($scope, $location, $routeParams, listService) { 
    $scope.data = listService.getDepartments();
    //$scope.id = $routeParams.id;

    //alert($route.current.params.id);

    //alert("test"+ "$routeParams");
   //$scope.Item=listService.getDepartments()[parseInt($routeParams.id)];
   var id = $routeParams.id;  

    $scope.Item=listService.getDepartments()[id];
    // saving an existing items
    $scope.save = function() {
      listService.editDepartments(id,{dialnumber:$scope.Item.dialnumber,department:$scope.Item.department,level:$scope.Item.level});      

查看固定的plunker:http://plnkr.co/edit/oZrQaPUNTOOxDt8kqU5t?p=preview