Skip to content

on FileUploaded event, so confusing #22

@epicleptico

Description

@epicleptico

Just reviwing what code does on FileUploaded event i got confused. File.

//All files are uploaded?
scope.allUploaded = false;

angular.forEach(scope.plFilesModel, function($file, key) {

  //Bug FIX, this logic will set allUploaded right
  if(file.percent != 100) {
    scope.allUploaded = false;
   } else if(file.id == $file.id) { //If the file is the same that we are reciving...
    //Set response on the file
    $file.response = JSON.parse(res.response);

    //Need throw event? throw it
    if(iAttrs.onFileUploaded) {
      var fn = $parse(iAttrs.onFileUploaded);
      fn(scope.$parent, {$response:res});
    }
  }         
});

My questions are:

  • ¿Who puts allUploaded scope variable to true?
  • throw event can be outside foreach Fn
  • What is the key to set $file.response = JSON.parse(res.response); if $file is just a temp variable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions