2

I'm new in AngularJS world and I have so many problems when I want to use a progress bar in my App.

I'm developing a quiz which has a "progress bar" with a countdown for every question, but when I change route (when I go ahead with other question) the progressbar doesn't work anymore, only on the first question. I spent so many hours searching for a solution and I don't make it work yet. :(

I read that I had to use directives to manipulate DOM (because with I need to change value and max attributes) but I'm not able to refresh the template... Also I used this ProgressBar (http://kimmobrunfeldt.github.io/progressbar.js/) but I have the same problem.

Anyone would know to help me?

Regards, Enrique.

EDIT: This is the code:

(html)

<ion-view title="Test" hide-back-button="true" >
   <ion-content class="padding" scroll="false">
  ..
    <progress id="progressbar" value="20" max="100"></progress>
  ..
   </ion-content>
</ion-view>

(controller)

var bar = document.getElementById('progressbar');
var loadCountdown = function() {
            $interval(function() {
                    bar.value = bar.value + 10;
            }, 1000, 15);
    }

On the first view It's works perfectly, but then it doesn't.

kikettas
  • 1,682
  • 1
  • 24
  • 31

1 Answers1

0

Use https://github.com/angular-ui/ui-router , it gives you the opportunity to use nested views and share the parent scope.

radpet
  • 701
  • 1
  • 5
  • 16
  • Actually I'm using that router, could I do a dinamic declaration of the views? Because I have a Quiz with diferent kind of tests (some with 100 questions, other with 30...). Thank you. – kikettas Dec 31 '14 at 15:45
  • yes you can look at this http://stackoverflow.com/questions/25866387/angular-ui-router-programmatically-add-states – radpet Jan 01 '15 at 12:33
  • I have a problem with that. For example: I'm at '../tab/test/0'and if I answer a question It goes to the next '/tab/test/1'. In this last route doesn't work the progressbar. And I'm at the same state, so I don't know if your solutions works for me because I have only 1 state. – kikettas Jan 14 '15 at 14:40