Comments (8)
It's hard for me to say with this information. Can the relevant pieces be placed in a project and sent to me, or out in a repository somewhere, so I can look at it first hand?
from ng-idle.
I am sorry but I can't share any part of the code since it's confidential and owned by my company. Only new things I added for your ngIdle implementation was
1 included in bower.json as shown below
{
"name": "com",
"version": "0.5.1",
"dependencies": {
"angular": "~1.3",
"angular-route": "~1.3",
"angular-touch": "~1.3",
"angular-animate": "~1.3",
"angular-resource": "~1.3",
"angular-cookies": "~1.3",
"angular-bootstrap": "~0.11.0",
"revolunet-angular-carousel": "~0.2.2",
"ng-grid": "~2.0.7",
"ng-idle": "latest",
"video.js": "~4",
"highcharts": "~3.0.7",
"jquery": "~2",
"jquery-ui": "~1.10.4",
"jqueryui-touch-punch": "git://github.com/furf/jquery-ui-touch-punch.git",
"angular-snap": "~1.4.1",
"snapjs": "latest"
},
"devDependencies": {
"angular-mocks": "~1.3",
"angular-scenario": "~1.3"
},
"resolutions": {
"angular": "~1.2.10",
"angular-touch": "~1.2.10",
"jquery": "^1.8.0"
}
}
2nd your code in app.js file
angular.module('myprojectname', ['ngIdle', 'ui.bootstrap'])
.controller('DemoCtrl', function($scope, $idle, $keepalive, $modal){
$scope.started = false;
function closeModals() {
if ($scope.warning) {
$scope.warning.close();
$scope.warning = null;
}
if ($scope.timedout) {
$scope.timedout.close();
$scope.timedout = null;
}
}
$scope.$on('$idleStart', function() {
closeModals();
$scope.warning = $modal.open({
templateUrl: 'warning-dialog.html',
windowClass: 'modal-danger'
});
});
$scope.$on('$idleEnd', function() {
closeModals();
});
$scope.$on('$idleTimeout', function() {
closeModals();
$scope.timedout = $modal.open({
templateUrl: 'timedout-dialog.html',
windowClass: 'modal-danger'
});
});
$scope.start = function() {
closeModals();
$idle.watch();
$scope.started = true;
};
$scope.stop = function() {
closeModals();
$idle.unwatch();
$scope.started = false;
};
})
.config(function($idleProvider, $keepaliveProvider) {
$idleProvider.idleDuration(5);
$idleProvider.warningDuration(5);
$keepaliveProvider.interval(10);
});
3rd script tag in index.html so it works on all pages of my application
<script type="text/ng-template" id="warning-dialog.html">Session Timeout Warning
You will be logged out in {{countdown}} .
Session Timed Out!
You were idle too long and session timed out. You were logged out.
from ng-idle.
Does it work if you run the app and try it?
That error indicates the module just isn't loaded, because it isn't there (wrong path, file permissions, etc.) which is the usual case, or couldn't be compiled (mangled, bad minification, etc.). I don't see anything outwardly wrong with your config, but I can't see the whole project either. I don't see any problems with the output of my builds, so I don't think that's the problem. It's got to be something with your environment or perhaps an oversight in your spec files.
I created a repository with a small test app with a similar config (just the basics). It has one karma test that loads and passes just fine. You can use this as a reference to try and find what is amiss.
https://github.com/HackedByChinese/ng-idle-test
Just clone that repo and run npm install
and it'll set itself up. Then run grunt test
to run the Karma tests.
Good luck.
from ng-idle.
Hi, Thanks for this, I will give it a shot. But ngIdle functionality is working perfect across my entire application which means module is loading correctly. Entire ngIdle feature works perfect except only the karma/jasmine fails which means either there is some library dependency issue or something else which I might have to add in karma/jasmine to incorporate ngIdle module. I will try and let you know so it helps others who might be using for karma/jasmine testing. Thanks for your help
from ng-idle.
Hi Thanks for your help. It was something related to how our application was built. It's solved now. Really amazing ngIdle module.
from ng-idle.
Glad you were able to sort it out. Good luck!
from ng-idle.
I too facing exact similar issue, could you please explain how did you resolved this issue?
from ng-idle.
Hi Thanks for your help. It was something related to how our application was built. It's solved now. Really amazing ngIdle module.
It would be more greatful If you explain more about how did you resolved this issue.
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.