2014-09-05 101 views
1

我正在從引導模態切換到Ekathuwa Angular模態。我有一個表格,當我點擊「Number」時,一個模式打開,輸入字段用所選對象屬性填充。我使用引導模式工作,但我迷失在如何做角度的方式。 plunkr如何從引導模態切換到角模態

控制器:

//editChangeOrderModal 
$scope.currentItem = null; 
$scope.editChangeOrderModal = function (model) { 
    $ekathuwa.modal({ 
    id: 'editChangeOrderModal', 
    scope: $scope.currentItem = model, 
    templateURL: "modal-template.html" 
    }); 
}; 

視圖:

<table class=" table table-bordred table-striped table-hover"> 
    <tr> 
    <th style="font-weight: bold;">Number</th> 
    <th style="font-weight: bold;">Date</th> 
    <th style="font-weight: bold;">Name</th> 
    </tr> 
    <tr ng-repeat="job in ChangeOrders" class=" pointer"> 
    <td ng-click="editChangeOrderModal(job)">{{job.ChangeOrderNumber}}</td> 
    <td>{{job.ChangeOrderDate}}</td> 
    <td>{{job.ChangeOrderName}}</td> 
    </tr> 
</table> 

<div class="col-xs-12"> 
    <div class="inline-fields" style="margin-top:30px"> 
    <label>Name:</label> 
    <input style="width:150px" ng-model="currentItem.ChangeOrderName" type="text"> 
    </div> 
    <div class="inline-fields"> 
    <label>Number:</label> 
    <input style="width:150px" ng-model="currentItem.ChangeOrderNumber" type="text"> 
    </div> 
    <div class="inline-fields"> 
    <label>Date:</label> 
    <input style="width:150px" ng-model="currentItem.ChangeOrderDate" type="date"> 
    </div> 
    <br/> 
    <input style="float:right" 
     ng-click="printEditChangeOrderModal(currentItem)" 
     type="button" 
     value="Print" 
     go-click="#"/> 
    <input style="float:right" 
     ng-click="updateChangeOrder(currentItem)" 
     type="button" 
     value="Save" 
     go-click="#"/> 
    <input style="float:right" 
     type="button" 
     data-dismiss="modal" 
     value="Exit" 
     go-click="#"/> 
</div> 

回答

1

我認爲這個問題是用這條線,

scope: $scope.currentItem = model, 

我改變這種

$scope.currentItem = null; 
    $scope.editChangeOrderModal = function(model) { 
     $scope.currentItem = model; 
     console.log(model); 
     $ekathuwa.modal({ 
      id: "editChangeOrderModal", 
      scope:$scope, 
      templateURL: "modal-template.html" 
     }); 
    } 

我叉你的[plunker]:http://plnkr.co/edit/OTJA6n7WADN5bprZaQco?p=info

+0

非常感謝您! – texas697 2014-09-05 19:41:57