Skip to content

Instantly share code, notes, and snippets.

@xiajngsi
Created May 26, 2016 07:22
Show Gist options
  • Save xiajngsi/0bcd8039fe166bc1d1e3c3b53cb41790 to your computer and use it in GitHub Desktop.
Save xiajngsi/0bcd8039fe166bc1d1e3c3b53cb41790 to your computer and use it in GitHub Desktop.
angular 分页无刷新,浏览器后退前进
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