angualr页面返回上一页,上一页数据没了。
点击查询,点击选中资料12月份,返回上一页,并不是12月,中间内容清空了。
fastTicket: {
url: '/fastTicket',
template: __inline('./views/fastTicket.html'),
controller: ["$scope", "$state", "$stateParams", '$rootScope', '$sessionStorage', 'dataHelper', 'tip', '$location', function($scope, $state, $stateParams, $rootScope, $sessionStorage, dataHelper, tip, $location) {
// var currentYear = new Date().getFullYear();
$scope.currentYear = new Date().getFullYear();
$scope.currentMonth = new Date().getMonth() + 1;
$scope.$on('datePickerInfo', function(event, data) {
$scope.currentYear = data.year;
$scope.year = data.year;
var m = Number(data.month) < 10 ? '0' + data.month : data.month;
$scope.month = m;
$scope.currentMonth = m;
var query = data.year + '-' + m;
dataHelper.monthlyBillsInvoiceList(query).then(function(result) {
if(result && result.code == 0) {
if(!result.data.length) {
tip.warn(1, '没有查询到相关信息');
$scope.list = {};
return;
}
$scope.list = result.data;
} else {
tip.warn(result.code, result.msg);
}
});
});
$scope.pjx = function(id, status) {
var absUrl = $location.absUrl(),
query = $scope.year + '' + $scope.month;
if($location.search().page) {
var pg = absUrl.replace(/page=(\d+)/, 'page=' + $location.search().page);
} else {
var pg = absUrl + "?page=" + query;
}
history.pushState({}, "", pg);
$sessionStorage.data = $scope.list;
$state.go('billDetail', {
id: id,
status: status
});
}
$scope.$on('pjax', function(event, data) {
if(data == 1) return;
$scope.currentYear = parseInt(new String(data).substring(0, 4), 10);
$scope.currentMonth = parseInt(new String(data).substring(4), 10);
var data = $sessionStorage.data;
$scope.list = data;
})
}]
},
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论