ng-idle icon indicating copy to clipboard operation
ng-idle copied to clipboard

Setting timeout with variable data

Open alexandroscgb opened this issue 7 years ago • 2 comments

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.

alexandroscgb avatar Jun 30 '17 21:06 alexandroscgb

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!

adamfollett avatar Jul 26 '17 16:07 adamfollett

@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

mberrang avatar Jul 26 '17 16:07 mberrang