本文介绍了“上传者"必须是 FileUploader 的一个实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我提到了这个:https://github.com/nervgh/angular-file-upload/tree/version-3.0.0-alpha

angular.min.js:14540 TypeError: "Uploader" must be an instance of FileUploader
    at link (http://localhost:8080/services/angular-file-upload.js:1874:24)
    at invokeLinkFn (http://localhost:8080/lib/js/angular.min.js:10445:8)
    at nodeLinkFn (http://localhost:8080/lib/js/angular.min.js:9733:9)
    at compositeLinkFn (http://localhost:8080/lib/js/angular.min.js:8712:10)
    at compositeLinkFn (http://localhost:8080/lib/js/angular.min.js:8717:10)
    at compositeLinkFn (http://localhost:8080/lib/js/angular.min.js:8717:10)
    at compositeLinkFn (http://localhost:8080/lib/js/angular.min.js:8717:10)
    at compositeLinkFn (http://localhost:8080/lib/js/angular.min.js:8717:10)
    at publicLinkFn (http://localhost:8080/lib/js/angular.min.js:8567:9)
    at link (http://localhost:8080/lib/js/angular-route.js:1053:5) <input type="file" nv-file-select="" uploader="uploader" multiple="">

推荐答案

FileUploader 应该在控制器全局范围内,以便创建一个对应于 FileUploader 的对象.我做了一个工厂并在整个控制器中使用它.

FileUploader should be in controllers global scope in order to make an object respective to FileUploader. I made a factory and used it throughout the controller.

这篇关于“上传者"必须是 FileUploader 的一个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 14:12