Hi,
I'm designing a view for displaying large results set (list of users), thus
it is paginated server side.
So far I've been binding ng-click="changePage(pageNum)" for my pagination
links, however I'd like the page number to be persisted in the url, thus I
thought of switching to simple href="#/users/{{ pageNum }}", and resolving
the request in the $routeProvider.when "resolve" property. Finally it looks
like this:
$rp.when('/users/page/:PageNumber', {
templateUrl: 'partials/users/user_list.html',
controller: 'UserListCtrl',
resolve: {
users: ['Restangular', '$route', function(Restangular, $route){
return Restangular.all("user").getList({_PageNumber:
$route.current.params.PageNumber || 1, _PerPage: 10});
}]
}
});
*This seems fine, but when introducing columns sorting, and optionally -
filtering, that would require me to pass quite a lot of data via the url,
some of them would be optional...*
*What would be yours approach?*
The real life angular apps with pagination I've seen (like
builtwith.angularjs.org) *do not* persist the page number in the url (which
I don't find user friendly. When I'm browsing, say, page 12 out of X, and
click one of the items, than go back... I'm on the first page!!)
Best Regards
Michal Gajek
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.