2

I'm trying to setup a progress bar and update it's progress with angular like this

<progressbar value="{{data.progress}}"></progressbar>

The controller code :

myApp.controller( "MainCtrl", [ "$scope", "$timeout", function($scope, $timeout) {
    $scope.data = { progress : 0 };
    (function progress(){
        if($scope.data.progress < 100){
            $timeout(function(){
                $scope.data.progress += 1;
                progress();
            },200);
        }
    })();
}]);

The bar is not updating while the data.progress variable is. It's not even showing ! What's wrong with that design ?

http://jsfiddle.net/1ptm607v/2/

2 Answers 2

2

You should provide an expression to progressbar directive:

<progressbar value="data.progress"></progressbar>

With {{}} Angular evaluates the expression, but this is not what you need.

By the way, there also was an error in console about it, so keep developer tools open all the time for simpler debugging.

Demo: http://jsfiddle.net/1ptm607v/3/

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you though what I meant to ask with the question (which was incorrect I should have used <progress> instead of <progressbar>) was why html element progress not progressbar (which is angular) does not support that kind of design.
Not sure I understand the question, but actually HTML5 progress element does support something like this. Take a look at quick demo: jsfiddle.net/0ykok3m6
-1

progress-value is another way to do it:

<span class="progress-value">{{data.progress}}%</span>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.