chr*_*ina 36

您无法确定,因为浏览器页面刷新等同于退出应用程序然后再次打开它.

您可以做的是检测页面退出事件和应用程序打开事件.

在app.run()块中注入'window'依赖项并添加:

window.onbeforeunload = function () {
   // handle the exit event
};
Run Code Online (Sandbox Code Playgroud)

和$ routeChangeStart事件

$rootScope.$on('$routeChangeStart', function (event, next, current) {
  if (!current) {
    // handle session start event
  }
});
Run Code Online (Sandbox Code Playgroud)

如果肯定你需要链接这两个事件,它必须在后端/服务器端....

我希望这有帮助.