Plupload不适用于ng-dialog

时间:2015-01-04 17:47:03

标签: javascript angularjs plupload ng-dialog

我试图通过ng-dialog生成的模态窗口中进行plupload工作。代码是:

$scope.showManager = function(){
  ngDialog.open({
    template: '/template/fmanager.html',
    controller: 'FileManagerController'
  });
}

app.controller('FileManagerController', function($scope){
    $scope.plupload = new plupload.Uploader({
        browse_button: 'browseFileButton',
        url: '/upload/path',
        init: {
            FilesAdded: function(uploader, files) {
                uploader.start();
            }
        }
    });

    $scope.plupload.init();
});

浏览按钮无效。我试图创建init函数,但没有成功。

$scope.init = function(){
  $scope.plupload.settings.browse_button = 'browseFileButton';
  $scope.plupload.refresh();
  $scope.plupload.init();
}

请提出任何建议。

1 个答案:

答案 0 :(得分:0)

考虑一下这篇文章http://benohead.com/angularjs-using-plupload-in-a-dialog/。在命令控制器中使用$ timeout作为init函数:

$timeout(function(){$scope.plupload.init();},300);

希望它有所帮助!