0

我有一个引导对话框,用户可以在其中输入运输跟踪号。2 个按钮 - 一个取消,一个发货。控制器与此相关联。成功后,我想将该订单的状态(在 ng 重复列表中)更改为“已发货”。但它不起作用。我在这里做错了什么?

带有对话框子控制器的控制器:

function ManageOrderCtrl($scope, $http, $dialog) {

  // Setup some dialog options for shipping popup
  var dialogOptions = {
    controller: 'ShipOrderCtrl',
    templateUrl: '/partials/order/_ship.html'
  };

  // Shipping action - launches popup for tracking #
  $scope.shipOrder = function(order){
      var itemToEdit = order;
     $dialog.dialog(angular.extend(dialogOptions, {
        resolve: {
          order: angular.copy(itemToEdit)
        }
      }
    ))
    .open()
     .then(function(result) {
      if(result) {
       angular.copy(result, itemToEdit);
       }
       itemToEdit = undefined;
     })
  };
}

// Shipping controller (injected in ship dialog)
function ShipOrderCtrl($scope, $http, order, dialog){
  $scope.order = order;

  // Called when they click "mark as shipped" on dialog
  $scope.ship = function() {

    dialog.close($scope.order);

     //This works fine from here
     //$scope.order.status = 'shipped';

    $http.put('api/order/ship/' + $scope.order._id, { 
      tracking: $scope.order.tracking 
    })
    .then(function(response) {

      // This doesn't work
      $scope.order.status = 'shipped';
    });
  };
  // Cancel the dialog
  $scope.close = function(){
    dialog.close(undefined);
  }; 
}

看法:

<div ng-conroller="ManageOrderCtrl">
   <div ng-repeat="order in orders">
     <span class="status">{{ order.status }}</span>
     <a href="#"  ng-click="shipOrder(order)"></a>
   </div>
</div>
4

1 回答 1

0

好的 - 这是 Angular Bootstrap 对话框中的一个错误 - 在 0.2.0 中修复 - 我使用的是 0.1.0

于 2013-03-11T05:09:37.367 回答