paging
This commit is contained in:
parent
8926299caa
commit
6df0999844
|
@ -8,10 +8,9 @@ export const COMPONENT = {
|
||||||
bindings: {
|
bindings: {
|
||||||
client: '<'
|
client: '<'
|
||||||
},
|
},
|
||||||
controller: function($http, $state)
|
controller: function($http, $state) {
|
||||||
{
|
|
||||||
var self = this;
|
var self = this;
|
||||||
let numPerPage = 2;
|
let numPerPage = 5;
|
||||||
let numRecords = 0;
|
let numRecords = 0;
|
||||||
|
|
||||||
this.$onChanges = function(changes) {
|
this.$onChanges = function(changes) {
|
||||||
|
@ -31,13 +30,14 @@ export const COMPONENT = {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
$http.get('/client/api/Addresses').then(
|
$http.get('/client/api/Addresses').then(
|
||||||
json => this.addresses = json.data
|
json => {
|
||||||
|
this.addresses = json.data;
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
this.getNumPages = () => {
|
this.getNumPages = () => {
|
||||||
var nPages = numRecords / numPerPage;
|
var nPages = numRecords / numPerPage;
|
||||||
if (nPages > 0)
|
self.numPages = Math.ceil(nPages);
|
||||||
self.numPages = (nPages % 2) ? Math.ceil(nPages) : Math.ceil(nPages) + 1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.figureOutToDisplay = () => {
|
this.figureOutToDisplay = () => {
|
||||||
|
|
Loading…
Reference in New Issue