search

Home  >  Q&A  >  body text

angular.js - angular view not updating

As shown in the figure, after selecting the file to upload, the file path will be displayed correspondingly in the Input. If you do not click the upload button during the process, click Cancel window and open it again, and the file path will still exist.

$('.part1_top_right').click(function(){
            $('.part1').hide();
            $('.part2').hide();
            $('.part3').hide();
            $('.part4').hide();
            $('.part5').hide();
            
            $scope.filePath="";
            
            $scope.cleanSelectFiles();
        });
$scope.cleanSelectFiles = function(){
            if(uploader.queue.length > 0){
                uploader.clearQueue();
                

                
                                
            }
        }

When you click Cancel, the Input is empty and the value of console.log is also empty.

Use $scope.$apply? And where?

曾经蜡笔没有小新曾经蜡笔没有小新2776 days ago587

reply all(2)I'll reply

  • 迷茫

    迷茫2017-05-15 17:05:00

    
    $('.part1_top_right').click(function(){
                $('.part1').hide();
                $('.part2').hide();
                $('.part3').hide();
                $('.part4').hide();
                $('.part5').hide();
                
                $scope.filePath="";
                $scope.$apply();
                $scope.cleanSelectFiles();
            });
    $scope.cleanSelectFiles = function(){
                if(uploader.queue.length > 0){
                    uploader.clearQueue();
                    
    
                    
                                    
                }
            }

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-15 17:05:00

    $('.part1_top_right').click(function(){
        $('.part1').hide();
        $('.part2').hide();
        $('.part3').hide();
        $('.part4').hide();
        $('.part5').hide();
        
        $scope.filePath="";//这就是你的input?如果是,那$apply在这就行
        $scope.$apply();
        
        $scope.cleanSelectFiles();
    });
    
    $scope.cleanSelectFiles = function(){
        if(uploader.queue.length > 0){
            uploader.clearQueue();
            
    
            
                            
        }
    }

    reply
    0
  • Cancelreply