AngularJS,导航栏中的数字在强制刷新时出现问题

问题描述

我创建了一个简单的通知系统,在导航栏中显示未读通信的数量通知)。
导航栏中的数字在4种情况下刷新:

问题是当您尝试强制刷新页面时(在浏览器中使用 ctrl + R)。虽然所有组件都刷新得很好,但跟踪该数字的功能似乎不起作用。

这是 index.html,其中导航栏被去除了不需要的链接(只有布告栏一个

<li ng-show="isLogged">
    <a ui-sref="noticeBoard">
        <span class="textColor">Notice Board
            <span ng-if="notifiesNumber > 0" class="notificationNumber">{{notifiesNumber}}</span>
        </span> 
    </a>
</li>

这里是 main.js,index.html 的控制器,覆盖了刷新的前 2 种情况

$scope.$on('checkNotificationNumber',function (event) {
    noticeBoardService.getNotifiesNumber.get(function (result) {
        if(result.status == "ok") $scope.notifiesNumber = result.notifiesNumber;
        //This console log is just to check the correct call every time
        console.log($filter('date')(new Date(),'HH:mm:ss') + " ---> " + $scope.notifiesNumber);
    },function (err) {
        console.log(err);
    });
});
      
$scope.$on('user:loggedin',function(event,data) {
    $scope.username = SessionService.getCurrentUsername();
    $scope.isLogged = true;
    
    $rootScope.$broadcast('checkNotificationNumber');
    
    window.timerNotification = setInterval(()=> {          
        $rootScope.$broadcast('checkNotificationNumber');
    },300000);
    
    $location.path("/");
});

我没有插入 noticeBoard 控制器和 html,因为我认为它不会影响刷新情况。关于我应该如何修改以使其也能强制刷新浏览器的任何建议?
提前致谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)