从一页移动到另一页

move from one page to another page

本文关键字:一页 移动      更新时间:2023-09-26

我正在使用angular js和jquery mobile创建一个移动应用程序。最后一页有一个成绩表,还有一个按钮可以再次练习。当我点击该按钮时,页面正在重定向到另一个页面,但突然它又回到了最后一个页面。

html:

<p align="center"><a href="#pageone" class="ui-btn ui-corner-all ui-shadow ui-btn-inline" ng-click="redirect(sid);history.go(0)">Practise Again</a></p>

角度js:

$scope.redirect = function(stdid){
    $http.get('php/practiseagain.php?stud_id='+stdid).success(function(response) {
    document.getElementById('tab_display').innerHTML = " ";
    window.location = "#pageone";
});
    //document.location.reload(true);
}

它正在重定向到第一页,但在那几分之一秒内,它又回到了结果页。有人能帮我吗。提前感谢

如果您在应用程序中使用$routeProvider进行路由,则可以使用Angular本身提供的$位置服务重定向到特定视图:

$location.path('/pageone');

要滚动到特定的零件或元素,您可以使用$anchorScroll:

https://docs.angularjs.org/api/ng/service/$anchorCroll