Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to launch upload with submission? #3

Open
gwenael-louandre opened this issue Mar 27, 2016 · 3 comments
Open

How to launch upload with submission? #3

gwenael-louandre opened this issue Mar 27, 2016 · 3 comments

Comments

@gwenael-louandre
Copy link

Hello,

I succeeded in using your modules and it works perfectly. However I would like to use it in a form and the problem is that the user has to upload each file and then submit the form. Is it possible to launch the uploads with the form submission?

Thanks.

@saburab
Copy link
Owner

saburab commented Mar 29, 2016

try to send a broadcast signal on submitting your form:

$scope.$broadcast('schemaFormFileUploadSubmit');

something like:

$scope.onSubmit = function(form) {
    // First we broadcast an event so all fields validate themselves
    $scope.$broadcast('schemaFormFileUploadSubmit');

    // Then we check if the form is valid
    if (form.$valid) {
      // ... do whatever you need to do with your data.
    }
  }

pls let me know if it worked

@jonathanread
Copy link

jonathanread commented Nov 30, 2016

I also would like to know how to do this. On my endpoint i return back an id and need all the ids of the files being uploaded to make DB associations. Can you please elaborate on how to do this? Thanks! When using $broadcast('schemaFormFileUploadSubmit') it does upload all files but how can i get the responses?

@krptodr
Copy link

krptodr commented Apr 20, 2017

@saburab Not sure how you expect to see if the form is valid and move on. Because even though the $broadcast is uploading the files, the controller still continues to execute additional code before the files are finished uploading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants