0

I’m using ng-Idle and getting an error when I populate KeepaliveProvider.http(…). For the most part I am using the code taken straight from the example given here http://hackedbychinese.github.io/ng-idle/

Here is my controller:

function timeoutCtrl(modelData, $scope, Idle, $log, $uibModal) {
var vm = this;
vm.config = {};

(function () {
    vm.config = modelData;
    Idle.watch();
}());

function closeModals() {
    if (vm.warning) {
        vm.warning.close();
        vm.warning = null;
    }
}

$scope.$on('IdleStart', function () {
    $log.debug('IdleStart');
    closeModals();

    vm.warning = $uibModal.open({
        templateUrl: 'timeout-warning-dialog.html',
        controller: 'TimeoutWarningController as timeoutWarning'
    });
});

$scope.$on('IdleEnd', function () {
    $log.debug('IdleEnd');
    closeModals();
});

$scope.$on('IdleTimeout', function () {
    $log.debug('IdleTimeout');
    window.location = '/Session/Timeout/' + vm.config.paxCode;
});

}

app.controller('TimeoutController', ['modelData', '$scope', 'Idle', '$log', '$uibModal', timeoutCtrl])
.config(['timeoutData', 'IdleProvider', 'KeepaliveProvider', function (timeoutData, IdleProvider, KeepaliveProvider) {
    IdleProvider.idle(timeoutData.timeoutIdleSeconds);
    IdleProvider.timeout(timeoutData.timeoutWarningSeconds);
    KeepaliveProvider.interval(timeoutData.keepAliveSeconds);
    KeepaliveProvider.http('/api/session/keepalive');
}]);

But after IdleStart opens the modal dialog, then any mouse move causes this error: enter image description here

$http(...).success is not a function

If I comment out the line that sets the KeepaliveProvider.http(…) then the error does not occur. But then my server session is not kept alive too.

I’ve Googled allot on this and most examples do not set the KeepaliveProvider.http(…). And the ones that do are doing the same thing I’m doing. Is there some configuration that must be done that is not in the example?

I'm using ng-Idle 1.2.2

1 Answers1

0

I figured out the issue here. I got AngularJS 1.6.1 via Nuget package. So, .success and .error are deprecated.

But somehow I got ahold of an older version of ng-Ilde version 1.2.2 which is using .success. Need to download the newest version of ng-Idle.