Skip to content

Commit

Permalink
Fixed Paging buttons #148
Browse files Browse the repository at this point in the history
  • Loading branch information
Zizzamia committed Jul 26, 2015
1 parent 6815c40 commit 0acb7a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/component/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ angular.module('ngTasty.component.table', [
if (updateFrom === 'filters') {
$scope.params['page'] = 1;
}
console.log(initNow);
$scope.url = buildUrl($scope.params, $scope.filters);
if ($scope.reload) {
$scope.reload = function () {
Expand All @@ -375,8 +374,8 @@ angular.module('ngTasty.component.table', [
setDirectivesValues(resource);
});
};
}
if (initNow) {
}
if (initNow || updateFrom === 'params') {
$scope.resourceCallback($scope.url, angular.copy($scope.params))
.then(function (resource) {
setDirectivesValues(resource);
Expand Down Expand Up @@ -404,7 +403,7 @@ angular.module('ngTasty.component.table', [
if ($scope.clientSide) {
$scope.$evalAsync(updateClientSideResource('params'));
} else {
$scope.$evalAsync(updateServerSideResource);
$scope.$evalAsync(updateServerSideResource('params'));
}
} else {
paramsInitialCycle = false;
Expand Down Expand Up @@ -691,7 +690,6 @@ angular.module('ngTasty.component.table', [
scope.pagMaxRange = 1;

getPage = function (numPage) {
console.log(numPage)
tastyTable.setParams('page', numPage);
};

Expand Down
3 changes: 1 addition & 2 deletions src/component/test/table-server-side.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -887,9 +887,8 @@ describe('Component: table server side', function () {
$scope.$digest();
});

it('should update params.page when page.get is clicked', function () {
it('should request a different API endpoint when page.get is clicked', function () {
tastyPagination.isolateScope().page.get(2);
$scope.$digest();
urlToCall = 'api.json?sort-by=name&sort-order=dsc&page=2&count=20';
$httpBackend.whenGET(urlToCall).respond(completeJSON);
$httpBackend.flush();
Expand Down

0 comments on commit 0acb7a2

Please sign in to comment.