ng-idle
ng-idle copied to clipboard
Setting timeout with variable data
Hi. I'm trying to set the timeout with a value that should come from a function in $scope, but in that momento of the app loading, nothing like $scope of anything else exists yet. How could I do this? Is it even possible?
Thanks.
Having the exact same issue. I need to pull the idle and timeout data from an external service depending on the client logged in. Any help on this would be great!
@alexandroscgb @adamfollett - Correct, you can't do this on config while angular is bootstrapping itself (you can only manually set the values in config and only providers can be injected into a configuration block)
However, after initial config, you should be able to use setTimeout()
or setIdle()
on the Idle service. You should be able to do that in any service, controller, or factory (e.g., immediately on/after login) that needs access to $scope (I would recommend a service).
See: https://github.com/HackedByChinese/ng-idle/issues/206#issuecomment-315958885