当模态对话框打开模式消失时,ng-repeat刷新

时间:2015-08-21 11:08:56

标签: angularjs angularjs-ng-repeat

当我打开模态对话框并通过websocket刷新下面的ng-repeat时,模态消失。 websocket回调刷新底层的ng-repeat。这会导致模态对话框消失,我必须刷新浏览器,返回ng-repeat数据。基本上,当刷新基础ng-repeat时,如何防止此模态消失?代码片段:

在控制器中:



app.controller('mainController', function($scope, $http, adminService) {

      // Setup
      $scope.viewData = [];
      // Get Events & Alarms
      function getClientDetails() {

        adminService.getView()
          .success(function(newViewData) {
            $scope.viewData = newViewData;

          })
          .error(function() {
            console.log('Client retrieval failed.');
          });
      };



 在服务中:


app.service('adminService', function ($http, $q, $rootScope) {

// interface
var service = {
    events: [],
    getView: getView

};
  function getView() {
    return $http({
      method: 'GET',
      url: 'app/services/data.php',
      params: {
        'act': 'getAFView'
      },
    }).

    success(function(data) {
      service.events = data.data;
      return (data.data);
    }).

    error(function(data) {
      console.log('error getting client data');
    });


  };




部分标记:



<tr ng-repeat="data in viewData | orderBy:'-EventId'| offset : currentPage*itemsPerPage |
                                        limitTo: itemsPerPage | filter:search">
                                        <td ng-class="{'danger': data.AckState === 'Unacknowledged',
                                            'active': data.AckState === 'Acknowledged',
                                            'info': data.AckState === 'Closed'}">
                                            <button type="button" class="btn"
                                                    data-toggle="modal" data-target="#editEventWindow{{$index}}" ng-click="Clear(data)">
                                                View
                                            </button>
                                            <div class="modal fade" id="editEventWindow{{$index}}" tabindex="-1" role="dialog">
                                                <div class="modal-dialog">
                                                    <div class="modal-content">
                                                           <div class="modal-header">
                                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                                                <h4 class="modal-title" id="addContactLabel">Details</h4>
                                                            </div>
&#13;
&#13;
&#13;

0 个答案:

没有答案