Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8766227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:29:55+00:00 2026-06-13T16:29:55+00:00

I have have a page where I am using plupload to upload files and

  • 0

I have have a page where I am using plupload to upload files and having a weird issue with a ng-repeat not updating properly. Here is the relevant code:

<div ng:app>
  <div name="myForm" ng-controller="Ctrl">
    <input ng-model="test" type="text" />{{test}}<div id="container" class="controls">
    <div id="filelist">
      <div ng-repeat="file in filesToUpload">{{file.name}} ({{file.size}}) <b>{{file.percent}}</b></div>
      </div>
      <br />
      <a id="pickfiles" href="#">[Select files]</a>
    </div>
  </div>
</div>​

function Ctrl($scope) {
    $scope.test = '';$scope.filesToUpload = [{id: 1, name: 'test', size: '123kb'}];

    $scope.addItem = function(object) {
        $scope.filesToUpload.push(object);
    }

    $scope.uploader = new plupload.Uploader({
        runtimes : 'html5,flash,browserplus,gears',
        browse_button : 'pickfiles',
        container : 'container',
        max_file_size : '10mb',
        url : 'upload.php',
        flash_swf_url : '/plupload/js/plupload.flash.swf'
    });

    $scope.uploader.init();

    $scope.uploader.bind('FilesAdded', function(up, files) {
        $scope.filesToUpload = [];
        $.each(files, function(i, file) {
            $scope.addItem({
                id: file.id,
                name: file.name,
                size: plupload.formatSize(file.size)
            });
        });

        console.log($scope.filesToUpload);

        up.refresh(); // Reposition Flash/Silverlight
    });
}​

Here is a trimmed down jsfiddle showing the issue happening:

http://jsfiddle.net/9HuUC/

To reproduce this issue do the following:

  1. Click on [select files] and selects a few files (notice how you don’t see the files displayed anywhere on the output)
  2. Type any character into the input box (magically the files that you select know appear)

What would cause this type of behavior? I mean I know that the data is properly being set in $scope.filesToUpload because I have the console.log() there and even checked it in Batarang and it loods good there but for some reason something else needs to be updated for the display to be updated.

Interestingly enough, I have another ng-repeat that is working fine on the same page. I am wondering if it has anything to do with where the code is (being inside the FilesAdded event on the uploader).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:29:56+00:00Added an answer on June 13, 2026 at 4:29 pm

    The issue is due to the fact that the FilesAdded callback is executed outside the scope of AngularJS (it’s called by the uploader), therefore the scope updates won’t be triggered.

    To solve this, just add the $scope.$apply call in the callback, encapsulating your existing code:

    $scope.uploader.bind('FilesAdded', function(up, files) {
        $scope.$apply( function() {
            $scope.filesToUpload = [];
            $.each(files, function(i, file) {
                $scope.addItem({
                    id: file.id,
                    name: file.name,
                    size: plupload.formatSize(file.size)
                });
            });
    
            console.log($scope.filesToUpload);
    
            up.refresh(); // Reposition Flash/Silverlight
        });
    });
    

    With this update, it’s working in the fiddle. For reference see the AngularJS official documentation, $apply method of the scope object:
    http://docs.angularjs.org/api/ng.$rootScope.Scope

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using plupload to upload files then redirect to an acknowledgement page. What
I have a problem here. I'm trying to manipulate a web page using jquery.
I have simple page using a two-column page layout that breaks on zooming. Here
I am using plupload to do an upload of multiple files to my server.
I have a page setup using code from here: http://www.jigar.net/articles/viewhtmlcontent78.aspx in order to post
I have a page using something along the lines of <meta http-equiv=refresh content=0;url=http://example.com/ />
I have page (Default1.aspx) in which I am redirecting to another page (Default2.aspx) using
I have saved an html page using the following line of code : NSURL
I have an ASP.NET page using the AJAX control toolkit for some controls. A
I have one page website only using HTML, CSS and JavaScript. I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.