, - URL-. , URL- . , URL-, .
:
http://www.codelord.net/2015/06/20/simple-pagination-and-url-params-with-ui-router/
, :
$stateProvider.state('list', {
url: '/list?page',
controller: 'ListCtrl',
controllerAs: 'list',
templateUrl: 'list.html',
params: {
page: {
value: '1',
squash: true
}
}
});
angular
.module('your.module')
.controller('ListCtrl', function ($state, $stateParams) {
var vm = this;
vm.page = parseInt($stateParams.page || '1');
loadStuffForList();
vm.onPageChange = function () {
$state.go('.', {'page': '' + vm.page}, {'notify': false});
loadStuffForList();
};
function loadStuffForList () {...};
});
- As for the Back button , if you do not want the user to use the browser button Back , I would do something like this:
<a ui-sref="list({page: vm.thisItemPage})">Back</a>
source
share