简体   繁体   中英

How to add a progress bar

I just started using ng-file-upload and it was a little complicated at the beginning but after some time reading I could achieve some things. But now Im stuck trying to add a progress bar, Im uploading pictures into Firebase and it works well, I can save it, update it and show the picture on the view, now I just need to add a progress bar to know what's going on while it's uploading.

I know the info to do it and some samples are out there but I can't find out how to add it to my code, hope you can give me a hand.

Here is my Javascript code:

$scope.submit = function(file) {

        Auth.$onAuth(function(authData){
        $scope.authData = authData;

            if(authData){
                if ($scope.file) {

                    console.log($scope.file);

                    var refImg = new Firebase("http://url.firebaseio.com/users/" + authData.uid);

                    Upload.base64DataUrl($scope.file).then(function(base64Urls) {
                        refImg.update({
                        FotoPerfil : base64Urls
                        });
                    });
                }    
            }
            else{
                window.location.href = '#/Bienvenidos';
            }
        });
    };

And my HTML:

<div class="btn btn-default" ngf-select ng-model="file" name="file" ngf-pattern="'image/*'" accept="image/*" ngf-max-size="2MB" ngf-min-height="100">Select picture profile</div>

<button class="btn btn-success" style="float:right;" ng-click="submit()">Save</button>  

<img src="{{perfil.FotoPerfil}}" ngf-no-object-url="true" />

Thanks so much,

Daniel

如何在Firebase 3.0中使用Firebase存储?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM