I want a simple paging control that updates the url, what is the ideal way to do this in angularjs?
ie:
http://www.site.com/widget/#/which/4
<a> Next </a>
For this, when Next link is clicked i want to update the url (and navigate to): http://www.site.com/widget/#/which/5
Any way that works, is easy to understand, and is maintainable is fine.
That said, you can just create links like so:
<a href="#/which/5">5</a>
presuming you have some route like so:
$routeProvider.when('which/:pageNo', {
controller: 'MyCtrl',
templateUrl: 'sometemplate.html'
});
It pretty simple just use below line
var pageIndex = $routeParams.pageNo
var newpageIndex = parseInt(pageIndex) + 1;
var url = '/which/' + newpageIndex
$location.path(url);