New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not able to update timer value inside ajax success response block. #36
Comments
You cannot set the timer's start time from an asynchronous call after directive compilation (page load). You need to re-compile the directive after the async response & attach it to the scope. Here is a plunkr that kinda does that - http://plnkr.co/edit/GjKSSVM1x2UQC2gLQeGo?p=preview The original issue #34 (comment) associated to that plunkr. |
Thanks, its working but timer is still not working properly, actually when user logged I stored the |
Siddii, any solution for above mentioned problem. Please give me any suggestion for that. |
Can you send a plunkr for your issue? I don't quite get whats happening here. |
Actually I want to create a 3 hours countdown timer for Online Exam which should not reset on page refresh. When user logged in I am storing timer start-time value in DB. So start time will comes from DB. Please check this plunk and help me to out of it |
I don't see anything new in that plunkr. It looks like the same one I showed earlier. Note that when you refresh the page/view the controller gets initialized & display values gets reset whether in a directive or not. I am guessing you probably need to store the displayed time in the DB & re-initialize directive on page load again. |
Yes you are right, I am storing the timer value (in milliseconds) in DB and initialize it on page load, So the value will remain same on every page load, but my countdown timer is not working. I want a 3 hours countdown timer for online exam. |
You could also use |
@apercu thanks for the answer, i will refer to your answer in some other issues. |
The example does not work. =) |
Hi, I want to put the timer value from my db, so that's why I am making a ajax call and the response will replace the value of the timer. but its not working, here is my code:
<timer start-time="startTime" interval="100" countdown="students.countdown"> <strong>{{hours}} hours, {{minutes}} minutes, {{seconds}} second</strong> </timer>
dashboardFactory.getTimerTime().then(function(response) { $scope.startTime = response.time; });
The text was updated successfully, but these errors were encountered: