Comments (4)
I was getting the $digets alrready in progress error, while trying to display the count down timer. Commenting out the $apply does the trick.
$scope.$on('IdleWarn', function(e, countdown) {
// $scope.$apply(function() {
$scope.value = countdown;
// });
});
Error Stack:
2015-03-19 17:39:57.726angular.js:10126 Error: [$rootScope:inprog] $digest already in progress
http://errors.angularjs.org/1.2.28/$rootScope/inprog?p0=NaNigest
at VALIDITY_STATE_PROPERTY (http://localhost:9000/bower_components/angular/angular.js:78:12)
at beginPhase (http://localhost:9000/bower_components/angular/angular.js:13122:15)
at Scope.$get.Scope.$apply (http://localhost:9000/bower_components/angular/angular.js:12908:11)
at http://localhost:9000/bower_components/ng-idle/angular-idle.js:292:18
at Scope.$get.Scope.$broadcast (http://localhost:9000/bower_components/angular/angular.js:13093:28)
at countdown (http://localhost:9000/bower_components/ng-idle/angular-idle.js:174:22)
at Array.deferred.promise.then.wrappedProgressback (http://localhost:9000/bower_components/angular/angular.js:11700:88)
at http://localhost:9000/bower_components/angular/angular.js:11668:28
at Scope.$get.Scope.$eval (http://localhost:9000/bower_components/angular/angular.js:12811:28)
at Scope.$get.Scope.$digest (http://localhost:9000/bower_components/angular/angular.js:12623:31)
from ng-idle.
You haven't read my issue carefully - changing scope insite event handling does not work without $apply
call. This is also used in the idle-countdown directive.
Library should not force users to call $apply
method. When target environment is not known (sometimes inside $digest loop, sometimes not), it may be good idea to implement sth like safe $apply
.
It's not a big deal as one can cope with that easily. But I have spent some time investigating why my scope is not refreshed after receiving IdleWarn
event.
from ng-idle.
@fracz Thanks !! Using safe apply resolves the issue.
from ng-idle.
When I originally laid out this module and looked at the right way to use $broadcast
in a module, there was back-and-forth over whether or not broadcasting an event should cause a digest (it does not), with plenty of reasonable arguments from either side. True enough, a number of ng-idle
users raised concerns over issues where ng-idle
causes digests (specifically that they don't want them).
In either case, it seems the most reasonable way to accommodate everyone is to err on the side of caution, but give people an easy-to-use alternative for those that don't want to apply (the idle-countdown
directive).
Solutions to make this work are trivial, so I don't feel compelled to change it unless it seems everyone wants it. I should, however, at least make this issue and the way to resolve it much clearer in the wiki.
from ng-idle.
Related Issues (20)
- [Question] Keepalive event in multiple tabs
- Issue in multiple tabs HOT 2
- Angular 5 - generic component child used in several main component not working
- Not want to reset timer in case of user intervention in app HOT 1
- Any plans to upgrade to Angular 6 HOT 1
- AngularJs - Unknown provider : IdleProvider HOT 1
- ng-Idle/core onIdleStart and onTimout function executing multiple times
- Having issues with ng-idle/core onIdleEnd & Mat-Dialog HOT 1
- keepalive onPingResponse subscribe response doesnt work right
- set url string parameter of http() dynamically
- Using JS Alert does not timeout until OK is Clicked HOT 1
- Key Management: Hardcoded Encryption Key HOT 1
- Select box (with multiple selections) not working properly
- unable to mock inactivity time with cypress clock/tick()
- How to use localstorageservice to handle in multiple tabs in the same browser HOT 1
- Incompatible with Angular 10 HOT 1
- Don't work with IFRAME HOT 3
- Keepalive interval not respected
- Implement a privacy preserving mode functionality avoiding usage of the persistent browser localStorage
- ng-idle not working for iOS in Ionic cordova
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ng-idle.