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

I can't get this module to work #35

Closed
kudlajz opened this issue May 9, 2014 · 4 comments
Closed

I can't get this module to work #35

kudlajz opened this issue May 9, 2014 · 4 comments

Comments

@kudlajz
Copy link

kudlajz commented May 9, 2014

Hi,

I have discovered this module to Angular and it looks great, but as hard as I am trying, I can't figure out how to use it.

I have a directive, in which I have this code

<form class="ui form">
    <div class="content ui segment">
        <div class="field">
            <input type="text" data-ng-model="data.title" placeholder="{{ 'Title'|translate }}">
        </div>

        <div flow-init="{target: '/api/outfit'}">
            <button type="button" class="ui button" flow-btn data-ng-show="!$flow.files.length">Select file with photo</button>
            <div class="field" data-ng-show="$flow.files.length">
                <img flow-img="$flow.files[0]">
            </div>
            <input type="submit" class="ui blue submit button" value="{{ 'Add outfit'|translate }}" data-ng-show="$flow.files.length">
        </div>
    </div>
</form>

What do I have to do, to:

  1. Begin file upload right after it is selected
  2. Begin file upload after the form is submitted?

Thanks a lot in advance.

@AidasK
Copy link
Member

AidasK commented May 10, 2014

  1. Begin file upload right after it is selected
    start upload on filesSubmitted event:
    flow-files-submitted="$flow.upload()"
    https://github.com/flowjs/ng-flow#quick-setup
  2. Begin file upload after the form is submitted?
<form ng-submit="$flow.upload()"> 
...
</form>

@AidasK AidasK closed this as completed May 10, 2014
@kudlajz
Copy link
Author

kudlajz commented May 10, 2014

Okay, but what is the $flow.upload() method? Do I have to declare it, or is it declared already?

@AidasK
Copy link
Member

AidasK commented May 10, 2014

flow-init directive creates new controller, which adds $flow variable to the scope.
$flow is new instance of https://github.com/flowjs/flow.js#flow

@AidasK
Copy link
Member

AidasK commented May 10, 2014

Answer: it is already declared.
Make sure you have flow-init declared on the form or above it to access $flow variable.

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

2 participants