Coder Social home page Coder Social logo

Comments (8)

moribvndvs avatar moribvndvs commented on August 19, 2024

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.

yashdoshi89 avatar yashdoshi89 commented on August 19, 2024

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}} .

</script> <script type="text/ng-template" id="timedout-dialog.html">

Session Timed Out!

You were idle too long and session timed out. You were logged out.

</script>

from ng-idle.

moribvndvs avatar moribvndvs commented on August 19, 2024

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.

yashdoshi89 avatar yashdoshi89 commented on August 19, 2024

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.

yashdoshi89 avatar yashdoshi89 commented on August 19, 2024

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.

moribvndvs avatar moribvndvs commented on August 19, 2024

Glad you were able to sort it out. Good luck!

from ng-idle.

vasanthakumarmk avatar vasanthakumarmk commented on August 19, 2024

I too facing exact similar issue, could you please explain how did you resolved this issue?

from ng-idle.

vasanthakumarmk avatar vasanthakumarmk commented on August 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.