ng-flow upload programmatically

北战南征 提交于 2019-12-04 03:03:54

At first, flow-files-submitted event is triggered when user pick a file (misleading name). So when you assign $flow.upload() to it, you make it uploading immediately after file selection.

Second thing is to get $flow object in your controller. Two ways comes to my mind:

A. As instruction say, you have to use flow-name attribute:

<div flow-init flow-name="obj.flow">

Then you have reference to $flow in yours $scope.obj.flow property and you can use $scope.obj.flow.upload() method anywhere in your controller.

B. Put your "Upload" button inside flow directive block (as a descendant of element with flow-init attribute) and use $flow property of directive scope as a parameter in ng-click, for example:

<button type="button" ng-click="myUploadMedhot($flow)">Upload</button>

and inside myUploadMethod(param) just call param.upload().

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!