I use dirpagination in my angular app to have pagination for my search results. I'm trying to create a dynamic title for the page based on search words and selected page.
<h2 class="page-title">{{app.set_page_title()}} - page {{app.pagination.current}}</h2>
The problem is I can't get the current page from dirpagination. Any idea how to do it?
Update:
<div class="search-item"
dir-paginate="item in app.get_results() | itemsPerPage: app.items_per_page">
<div class="item">
Lorem ipsum item
</div>
</div>
<div class="pull-left pagination-controls">
<dir-pagination-controls></dir-pagination-controls>
</div>
And this is my app structure:
angular.module('searchApp',
['ngRoute','angularUtils.directives.dirPagination'])
.controller('searchController', function($scope, $rootScope, $location) {
var app = this;
app.set_page_title = function() {
// Set the page title
return "Bla bla";
}
});
Solved with: - in my controller:
app.current_page = 1;
and then in my template:
<h2 class="page-title">{{app.set_page_title()}} - page {{app.current_page}}</h2>
<div class="search-item" dir-paginate="item in app.get_results() | itemsPerPage: app.items_per_page" current-page="app.current_page">