2014-01-20 22 views
2

我使用 AngularJS V1.2.6引導3.0.3使用angularjs和bootstrap3 modalInstance.dismiss( '取消')不工作在IE

this is an example of the problem on jsfiddle。它適用於FF和Chrome,但不適用於IE。

我有這樣的模態對話框,除非您關閉它在我的控制器使用IE9 Win7上

我必須有下面的代碼片斷爲偉大工程。與IE相同,$modalInstance.close(result);$modalInstance.dismiss('cancel');的行爲都相同。當顯示對話框時,您可以看到對話框,並通過預期的半透明bg查看後面的頁面數據。

但是,當我點擊關閉按鈕,對話框消失,以及後面的頁面。它完全變爲空白

任何人都有這個問題或知道如何解決它將不勝感激。

我在編輯這個,因爲我找到了更多信息。

此問題只顯示本身IF的HTML模式有一個iframe和IFRAME SRC是一個PDF

 <div class="modal-content"> 
      <div class="modal-header"> 
       <button type="button" class="close" ng-click="cancel()">&times;</button> 
       <h4 class="modal-title">FRAME</h4> 
      </div> 

      <iframe src="/pdf-test.pdf"></iframe> 

      <div class="modal-footer"> 
       <button type="button" class="btn btn-default" ng-click="cancel()">Close</button> 
       <!-- <button type="button" class="btn btn-primary" ng-click="close()">Close2</button>--> 
      </div> 
     </div><!-- /.modal-content --> 

這裏是一些開放式的,但我認爲其實並不重要,因爲如果如果出現問題,則iframe的src是任何對話框

var modalInstance = $modal.open({ 
      templateUrl: '/snippets/modal.html?v=3', 
      controller: ['$scope', '$modalInstance','modaldata', function($scope, $modalInstance, modaldata) { 

       $scope.modaldata = modaldata; 

       $scope.submit = function(feedback) { 
        $modalInstance.close({feedback: feedback}); 
       }; 

       $scope.close = function(result){ 
        $modalInstance.close(result); 
       }; 

       $scope.cancel = function() { 
        $modalInstance.dismiss('cancel'); 
       }; 
      }], 
      resolve: { 
       modaldata: function() { 
        return $scope.modaldata = 
        { 
         'id' : pmIdSeq 
         ,'iframeSRC' : iframeSRC 
         ,'modaltitle' : $scope.druggroupslist[arrayIdx].pm_Title 
        }; 
       } 
      } 
     }); 

回答

1

我找到了一種使其工作的方法。我認爲這一定是angularUI中的一個bug。

我不得不調用$ modalInstance.close之前清除的iframe src和這似乎現在在IE

   $scope.close = function(result){ 
        $('#myiframepfg').attr("src",'');//added so IE does not crash and burn 
        $modalInstance.close(result); 
       }; 
工作