angular1.26用uploadify做上传指令出现ui-router不能跳转页面
时间: 2015-01-19来源:开源中国
前景提要
HDC调试需求开发(15万预算),能者速来!>>>
用到uploadify作为上传指令的方式来上传文件吗?现在碰到这样的问题,在IE下按钮出来后,ui-router不能正常跳转页面,地址栏的url变了 却页面没有变化。
指令代码如下: /**上传文件 * <div upload id="sijiPerSelect_img" ng-model="sijiPerSelect_img" opts="{source_id:applyP,source:4,file_type:1,image:true,button_text:'选择图片',uid:userInfo.uid,isMsg:true,m2:false}"></div> * */ .directive('upload', function() { return { require: 'ngModel', restrict : 'A', // transclude: true, // replace : true, scope:{ ngModel:'=', opts:"=", title:"=" }, link : function($scope, element, attr,ngModel ) { var loginToken=login_token; //$scope.opts.login_token.replace(/\-/g,"_"); var url=rootPath+'/upload/'; var parameJson={ file_type:($scope.opts.file_type?$scope.opts.file_type:'1'), login_token:loginToken,appid:($scope.opts.appid?$scope.opts.appid:'0'), source_id:$scope.opts.source_id?$scope.opts.source_id:'', source:$scope.opts.source?$scope.opts.source:'', title:$scope.opts.title?$scope.opts.title:'',flag:$scope.opts.flag?$scope.opts.flag:'', uid:$scope.opts.uid?$scope.opts.uid:'', isMsg:($scope.opts.isMsg?$scope.opts.isMsg:false), m2:($scope.opts.m2!=undefined?$scope.opts.m2:true) }; $("#"+element.attr("id")).uploadify({ height :attr.height!=undefined&&attr.height!=""?attr.height:28, width :attr.width!=undefined&&attr.width!=""?attr.width:120, swf :rootPath+'/s/js/uploadify/uploadify.swf', uploader :rootPath+'/upload/', formData:parameJson, buttonText:$scope.opts.button_text?$scope.opts.button_text:'选择文件',//浏览文件', fileTypeExts:$scope.opts.image==false?attr.fileTypeExts:'*.png;*.jpg;*.jpe;*.jpeg;*.bmp;*.gif;', fileTypeDesc:$scope.opts.image==false?attr.fileTypeDesc:'图片文件;', onUploadSuccess:function(file, data, response) { eval("var json="+data+";"); if(json.op_ret_code=="000"){//上传成功 $scope.$apply(function() { try{ ngModel.$setViewValue({fid:json.fid,url:json.url}); $scope.ngModel=ngModel; }catch(e){ alert(1+"\n"+e); } }); }else{ $scope.$apply(function(){ try{ if(parameJson.m2==true){ ngModel.$setViewValue({fid:'0',url:'s/img/front/template/occupation/apply/2014_12_16/defaultUploadImg.jpg'}); }else{ ngModel.$setViewValue(json); } $scope.ngModel=ngModel; }catch(e){ alert(e); } }); } }, onUploadError:function(file,errorCode,errorMsg,errorString,swfuploadifyQueue){ } }); } } } )

页面模板调用上传指令如下:<div upload id="cheduiSelect_img" ng-model="cheduiSelect_img" opts="{source_id:applyP,source:4,file_type:1,image:true,button_text:'选择文件'}"></div>
在IE8910下按钮能够出来 但是点击菜单不跳转页面。而地址栏是变化了。
IE控制台的报错信息如下:

在IE11下按钮出不来。
正常图:

IE11下:

在IE8910下可以上传文件但是之后出现如下异常:


科技资讯:

科技学院:

科技百科:

科技书籍:

网站大全:

软件大全:

热门排行