Opening a modal window from an already opened moda

2019-07-31 10:48发布

问题:

I am trying to open a modal window from an already opened modal window in Angular JS. Briefly, I have a home page, from the home page which is basically a list page, when a user double clicks on a record in the list, a modal window opens up which has got three buttons - Save, Delete & Cancel. Clicking on the Delete button requires to open another modal window which would let the user to delete that record. Following is the code for the same :

home.html : This is the main page having a grid displaying multiple records in list view

{

    ...........
    .......... Grid rendering code starts her
    <div class="table-body-container">
      <table class="table table-hover table-without-bottom">
        <colgroup ng-repeat="header in headers" class="{{header.columnSize}}" ng-show="header.selected">
          <tbody ng-repeat="rccs in records">
            <tr ng-repeat="ri in rccs.recordcodes">
            ..............
            <td **ng-dblclick="editModal(ri)**" ng-show="headers[1].selected">{{ri.recordCodeType}}</td>
          ............
    ............
          ....
          </tbody>
        </colgroup>
      </table>
    </div>
...............
................
**<div ng-controller="ri.controller.EditCtrl"
  class="modal fade"
  ng-class="{'in' : editModalOpen}"
  ng-include="'resources/ri/views/editRI.html'">**
 </div>
.......................

}

In the above bold part, double clicking opens up a modal window. The .js part is below :

homectrl.js - the method editModal in this controller sets the editModalOpen to true which triggers the first modal window

{

......
.......
$scope.editModal = function(row) {
  $scope.updateRow = row;
  $scope.editModalOpen = true;
}

}

The template for the first modal window is "editRI.html" which has the following :

editRI.html {

.........
......
<div class="modal-footer">
  ......Cancel button HTML
  <button type="button" class="btn btn-primary" ng-click="deleteModal()">Delete</button>
...............
.........
    **<div ng-controller="ri.controller.EditCtrl"
      class="modal fade"
      ng-class="{'in' : deleteModalOpen}"
      ng-include="'resources/ri/views/deleteRI.html'">**
     </div>

}

The above html in the editRI template is supposed to open another modal window on top of the existing modal window so that the user can perform a delete operation for the record. I have checked these links already and made the changes accordingly but it did not work : - http://jschr.github.io/bootstrap-modal/ - I could not do much here as I also need to follow the standards that my team has followed in opening a dialog. - Open Modal from Modal - This looked to be exactly the similar case as mine, but the answer was not clear enough. I tried putting the html for the 2nd modal window in a separate file and tried but dint work.

Can someone please give some pointers to me as per the above code ????