question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ngf-select function called with null

See original GitHub issue

Hi, I think there is a problem with the function ngf-select="uploadFile($file)" following these steps:

  1. Click to select a file
  2. Click to select another file

When clicking the second time, the function uploadFile is called with $file = null. Fiddle of the issue https://jsfiddle.net/kikar/25qnends/

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
danialfaridcommented, Feb 10, 2016

You might already know but you can get the rejected files by ngf-model-invalid or ngf-select=“select($invalidFiles, $files)”. The files that won’t pass the validation won’t be set to model or $files.

0reactions
fbarbatcommented, Feb 10, 2016

I tried this issue’s fiddle and it works different to my application. This fiddle (ng-file-upload version 11.2.3) returns file, null and then file again. In my application (ng-file-upload version 7.3.9) it just return file and then null. The last file never comes.

Now I understand why you say it works. By design clients must allow nulls to be received when these cases happen (for example, when the button is clicked a second time or errors). I can’t upgrade right now so I will have to implement a workaround. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

When I select button using ngf-select, ng-model is changed to ...
when i click ptgui-imagebox showing image, ng-model is changed. but I want to maintain image before I select new image. How can I...
Read more >
48 answers on StackOverflow to the most popular Angular ...
How can I get new selection in “select” in Angular 2? Angular exception: Can't bind to 'ngForIn' since it isn't a known native...
Read more >
Success with ng-file-upload and xdomain - Plunker
querySelectorAll("input,select")).filter(function (e) { var _ref; ... getResponseHeader = function (header) { var name; name = header != null ? header.
Read more >
Upload File using Angular.JS and Node.JS | by Hensle Joseph
cb(null, file.fieldname + '-' + datetimestamp + '. ... are displaying the thumbnail of the file selected using the ngf-thumbnail directive.
Read more >
angularjs – Adeel's Corner
Then the ngf-select directive can be used to define a function which is called AFTER the resizing is complete, and this is where...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found