angularjs $anchorScroll sometimes refresh all page

前端 未结 3 1765
眼角桃花
眼角桃花 2021-01-22 08:38

I have an app with angularjs routing, but on some view i want to scroll to some specific div and i use anchorScroll but sometimes (not all times) it refresh all page even i stop

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-22 08:59

    Try like this

    $scope.redirectTodiv = function(divname,event) {
       var id = $location.hash();
        $location.hash(divname);
        $anchorScroll();
        $location.hash(id);
    
     };
    

提交回复
热议问题