7

I need to use the single-file attribute in the ng-flow, i have to use it because this attribute other than limits the nuber of file to send, substitute the file thate was added until the upload event, see this:

singleFile Enable single file upload. Once one file is uploaded,
second file will overtake existing one, first one will be canceled. (Default: false)

this is the documentation taken from flow.js git repository.
What i really need to do is to put this attribute in the factory, because i need to set this for all my input file field. I have try to search it in the ng-flow documentation, but it lack of a lot of explanaion, anyone know how to do this? Otherwise anyone know where to find a complete good docummentation of this module?

Herb Caudill
  • 50,043
  • 39
  • 124
  • 173
mautrok
  • 961
  • 1
  • 17
  • 41

2 Answers2

16

Or using a tag like this:

<div flow-init="{target: '/upload', singleFile: true}"></div>
Vladimir Trifonov
  • 1,395
  • 11
  • 9
  • I like your option over @TheHouseplant. It keeps the code clean and encapsulates behaviour within the directive usage. – RandomUser Oct 02 '15 at 09:53
13

You could try setting it like this:

.config(['flowFactoryProvider', function (flowFactoryProvider) {
    flowFactoryProvider.defaults = {
        singleFile: true
    };
}])
thehouseplant
  • 353
  • 3
  • 10