AngularJs: Reload page

前端 未结 13 2152
孤城傲影
孤城傲影 2020-11-28 19:28
PORTAL_NAME

I want to reload the page. How can I do this?

13条回答
  •  失恋的感觉
    2020-11-28 19:54

    
                        
                        {{pendingEmployeeApprovalCount}}
                    
    

    and in the controller

     $scope.viewPendingApprovals = function(type) {
                    if (window.location.hash.substring(window.location.hash.lastIndexOf('/') + 1, window.location.hash.length) == type) {
                        location.reload();
                    } else {
                        $state.go("home.pendingApproval", { id: sessionStorage.typeToLoad });
                    }
                };
    

    and in the route file

    .state('home.pendingApproval', {
            url: '/pendingApproval/:id',
            templateUrl: 'app/components/approvals/pendingApprovalList.html',
            controller: 'pendingApprovalListController'
        })
    

    So, If the id passed in the url is same as what is coming from the function called by clicking the anchor, then simply reload, else folow the requested route.

    Please help me improve this answer, if this is helps. Any, suggestions are welcome.

提交回复
热议问题