AngularJS使用uploadify外掛程式的問題總結

來源:互聯網
上載者:User

標籤:分析   gettime   切換   ext   總結   row   執行個體   this   觸發事件   

 AngularJS使用uploadify的過程中遇到了兩個問題,總結如下:

 

  • 某個頁面需要同時執行個體化多個uploadify組件時,出現“ID SWFUpload_0 is already in use. The Flash Object could not be added”的錯誤,分析jquery.uploadify.js代碼發現,是由於是執行個體化SWFUload時用的是同一個名字,解決是:找到initSWFUploadify,修改如下(紅色部分):
SWFUpload.prototype.initSWFUpload = function(b) {    try {        this.customSettings = {}, this.settings = b, this.eventQueue = []; var mydate = new Date(); this.movieName = "SWFUpload_" + mydate.getTime().toString(), this.movieElement = null, SWFUpload.instances[this.movieName] = this, this.initSettings(), this.loadFlash(), this.displayDebugInfo();    } catch (a) {        throw delete SWFUpload.instances[this.movieName], a;    }
  • IE8/9出現ui-router不能跳轉頁面,地址欄的url變了,但是頁面卻沒有變化,出現報錯資訊:

SCRIPT5007: 無法設定屬性“SetButtonTextPadding”的值: 對象為 null 或未定義 
SCRIPT5007: 無法設定屬性“SetButtonTextStyle”的值: 對象為 null 或未定義 
SCRIPT5007: 無法設定屬性“SetButtonAction”的值: 對象為 null 或未定義 
SCRIPT5007: 無法設定屬性“SetButtonDisabled”的值: 對象為 null 或未定義 
SCRIPT5007: 無法設定屬性“SetButtonCursor”的值: 對象為 null 或未定義 
SCRIPT5007: 無法設定屬性“TestExternalInterface”的值: 對象為 null 或未定義 
SCRIPT5007: 無法擷取屬性“SetReturnValue”的值: 對象為 null 或未定義 
SCRIPT5007: 無法擷取屬性“SetReturnValue”的值: 對象為 null 或未定義

這是由於在切換路由的時候,沒有銷毀uploadify執行個體對象導致的,解決辦法如下:

  //狀態切換開始時觸發事件,銷毀uploadify對象
  $scope.$on(‘$stateChangeStart‘, function(e, toState, toParams, fromState, fromParams) { if (e && $(‘.uploadify‘).length > 0) { $(‘.uploadify‘).each(function (item) { $(this).uploadify(‘destroy‘); }) } });

 

參考:http://blog.csdn.net/zhichao2001/article/details/46662705/

 

AngularJS使用uploadify外掛程式的問題總結

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.