【问题标题】:AngularJS jQuery File Upload Plugin Errors in a $Dialog Service Box$Dialog 服务框中的 AngularJS jQuery 文件上传插件错误
【发布时间】:2013-05-12 17:53:42
【问题描述】:

我正在使用 $dialog 引导指令在 $dialog 框中实现找到的 jquery 文件上传插件的 AngularJS 代码:http://blueimp.github.io/jQuery-File-Upload/http://angular-ui.github.io/bootstrap/#/dialog

一切都按预期工作,模态出现正常,文件上传正常等...问题是当模态关闭时,会出现 3 个错误,然后无论何时打开或关闭模态,它们都会继续在控制台上显示。它们是:

cannot call methods on fileupload prior to initialization; attempted to call method 'processing'
cannot call methods on fileupload prior to initialization; attempted to call method 'active'
cannot call methods on fileupload prior to initialization; attempted to call method 'progress'

我可以看到错误可能发生在哪里,我只是不确定为什么或如何解决这些问题。谢谢!

这是一个包含相关问题的 plnkr。 http://plnkr.co/edit/vQUpJGBPGNNKsU91qIG3

【问题讨论】:

    标签: javascript angularjs angular-ui


    【解决方案1】:

    您应该在user-photo-tpl.html 中使用ng-attr-data-fileupload="options" 而不是data-fileupload="options"。但为了让它工作,你应该将你的角度升级到最新版本。这个 ng-attr-* 允许在解析后将属性添加到 DOM 元素。

    【讨论】:

    • 处理错误,但是在添加要上传的文件后,它不会添加文件。 编辑更新了 plunker 以显示这一点。
    【解决方案2】:

    此问题已在最新版本的插件中得到解决,重新使用 data-fileupload 参数。

    plunker 已更新以反映这一点。

    【讨论】:

      猜你喜欢
      • 2015-02-17
      • 2012-02-24
      • 1970-01-01
      • 1970-01-01
      • 2014-01-01
      • 2012-10-04
      • 1970-01-01
      • 2016-07-10
      • 1970-01-01
      相关资源
      最近更新 更多