angularjs - refresh when clicked on link with actual url

后端 未结 10 1269
深忆病人
深忆病人 2020-12-02 10:13

I use routeProvider to define controlers and templates for my urls.

When I click on the link, which has the same url as is the actual location, nothing happens. I w

10条回答
  •  自闭症患者
    2020-12-02 10:28

    I tried Wittaya's solution above using directive approach. Somehow the directive keeps throwing error. I end up with this solution

    HTML

    Devices
    

    Controller

        $scope.stateGo = function (stateName) {
            if ($state.$current.name === stateName) {
                $state.reload();
            } else {
                $state.go(stateName);
            }
        }
    

提交回复
热议问题