Angularjs The use of uploadify in the process encountered two problems, summarized as follows:
- When a page needs to instantiate multiple uploadify components at the same time, the "ID Swfupload_0 is already in use" appears. The Flash Object could not being added "error, Analysis of Jquery.uploadify.js code discovery, is due to be instantiated swfuload with the same name, the solution is: Find Initswfuploadify, modify the following (red part):
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 Deleteswfupload.instances[ This. Moviename], A; }
- IE8/9 appear ui-router can't jump page, address bar URL changed, but the page has not changed, error message:
SCRIPT5007: Cannot set value for property ' setbuttontextpadding ': object is null or undefined
SCRIPT5007: Cannot set value for property ' Setbuttontextstyle ': object is null or undefined
SCRIPT5007: Cannot set value for property ' Setbuttonaction ': object is null or undefined
SCRIPT5007: Cannot set value for property ' setbuttondisabled ': object is null or undefined
SCRIPT5007: Cannot set value for property ' Setbuttoncursor ': object is null or undefined
SCRIPT5007: Cannot set value for property ' Testexternalinterface ': object is null or undefined
SCRIPT5007: Could not get value for property ' Setreturnvalue ': object is null or undefined
SCRIPT5007: Could not get value for property ' Setreturnvalue ': object is null or undefined
This is due to the fact that the uploadify instance object was not destroyed when switching routes, and the workaround is as follows:
Trigger event at start of State switch, destroy Uploadify object
function (E, ToState, Toparams, FromState, fromparams) { if (E && $ ('. Uploadify '). length > 0 { $ ('. Uploadify '). Each (thefunction (item) { $ (this). Uploadify (' Destroy ') ); }) } });
Reference: http://blog.csdn.net/zhichao2001/article/details/46662705/
Angularjs use of uploadify plug-in problem summary