泽西岛1.7和角js。防止重发请求

时间:2013-12-28 04:57:36

标签: angularjs nginx glassfish jersey

美好的一天,

我们的REST服务运行时间很长。问题恰好是在10分钟后对同一用户重复请求资源。我不知道它是否在使用NGINX作为代理的Angular方面,或者它在我们的服务所在的Glassfish 3.1服务器中。在我检查的浏览器上,我无法看到第二个请求。 有人有线索吗?

1 个答案:

答案 0 :(得分:0)

您需要设置时间间隔

function bindBorrowings()
{
//code
}

var setTimeOut = setInterval(function () {
           $scope.$apply(bindBorrowings());
       }, 5000);
导航到其他页面时

clearinterval

$scope.$on('$routeChangeStart', function (scope, next, current) {
           if (next.$$route.controller != "CurrentctrlName") {
               clearInterval(setTimeOut); // clear interval here
           }
       });