2016-09-12 26 views
0

我想使用的代碼:https://github.com/davidjbradshaw/iframe-resizer獲得一個沒有定義iFrameResize錯誤AngularJS

在我的index.html頁我已經包括(和它的負載):

<script src="./Scripts/iframeResizer.js"></script> 

在我iframe中的內容頁面我已經包括:

<script src="iframeResizer.contentWindow.min.js"></script> 

我AngularJS控制器:

ajs_module.controller("MyController", 
     ['$scope', '$window', function ($scope, $window) { 

      $scope.iframeLoadedCallBack = function() { 
       console.log('Resizing iFrame...'); 
       iFrameResize({ log: true }); // causes: Uncaught ReferenceError: iFrameResize is not defined 
      } 
}]) 

當主機頁面加載,並嘗試調整的iFrame,我得到的錯誤:

Uncaught ReferenceError: iFrameResize is not defined 

感謝您的幫助。

回答

0

角用途JqLite,而不是正常的jQuery,也許你需要加載iframeResizer.js腳本

之前添加的jQuery如果你不能訪問一個全球性的功能應該是因爲沒有initializated

(檢查其他dependendies但我沒有發現任何其他的iframeResize頁面)

+0

我加載的jQuery:感謝。 – Sako73

0

你試過做window.iFrameResize?因爲它看起來像一個範圍界定問題。

在做不到這一點負載其與需要的js

相關問題