-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adds limit param to set number of results #1
base: master
Are you sure you want to change the base?
Conversation
@@ -253,6 +253,10 @@ angular.module('cbBigBoardCtlr').controller('cbBigBoardCtrl', ['$scope', | |||
if ($scope.hideLandingPages && landingPagesCount[host]) { | |||
limits[host] += landingPagesCount[host]; | |||
} | |||
//Force limit from param | |||
if (!isNaN(configService.limit)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you trying to check if 'limit' is defined on the configService object? This seems to specifically just check that configService.limit is not the value NaN. You'd probably want to do just a generic truthy check, since i imagine the limit should never be set to 0 legitimately? Could also just check that typeof limit is 'number'.
Thanks for the help @bowman224, updated with what I think is the more standard method...? |
@@ -253,6 +253,10 @@ angular.module('cbBigBoardCtlr').controller('cbBigBoardCtrl', ['$scope', | |||
if ($scope.hideLandingPages && landingPagesCount[host]) { | |||
limits[host] += landingPagesCount[host]; | |||
} | |||
//Force limit from param | |||
if (configService.limit) { | |||
limits[host] = configService.limit; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you try this out? I dont think all params are added to the configService. Alternatively you could do
if ($routeParams.limit) {
limits[host] = $routeParams.limit;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, alternatively you could extend DEFAULT_LIMIT to $routeParams.limit
Set the number of Top Pages to return using '&limit=XX' in the URL. Useful for displays with a portrait orientation.