Created
May 26, 2016 07:22
-
-
Save xiajngsi/0bcd8039fe166bc1d1e3c3b53cb41790 to your computer and use it in GitHub Desktop.
angular 分页无刷新,浏览器后退前进
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pageGetServingListNew() { | |
$window.history.pushState({"currentPage": vm.currentPage}, '我的服务', $location.absUrl()); | |
console.log( $window.history.state, " $window.history.state;"); | |
getServingListNew(); | |
} | |
$window.onpopstate = function () { | |
// 获得存储在该历史记录点的currentPage对象 | |
var currentPage = $window.history.state; | |
console.log(currentPage, "history json"); | |
if (currentPage == null) { | |
vm.currentPage = 1; | |
} else { | |
vm.currentPage = currentPage.currentPage; | |
} | |
getServingListNew(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment