{"id":19042034,"url":"https://github.com/writetome51/paginator-service","last_synced_at":"2026-05-15T17:42:15.557Z","repository":{"id":122062454,"uuid":"171570437","full_name":"writetome51/paginator-service","owner":"writetome51","description":"An injectable Angular 5+ service for paginating an array","archived":false,"fork":false,"pushed_at":"2019-02-20T00:14:57.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-02T07:26:06.964Z","etag":null,"topics":["angular","pagination","paginator","service","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/writetome51.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-20T00:09:05.000Z","updated_at":"2019-02-20T00:14:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"c6425850-86ca-4aa0-8d45-0355677d8110","html_url":"https://github.com/writetome51/paginator-service","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Fpaginator-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Fpaginator-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Fpaginator-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Fpaginator-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/writetome51","download_url":"https://codeload.github.com/writetome51/paginator-service/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240100512,"owners_count":19747683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","pagination","paginator","service","typescript"],"created_at":"2024-11-08T22:34:01.433Z","updated_at":"2026-05-08T19:30:17.698Z","avatar_url":"https://github.com/writetome51.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PaginatorService\n\nAn injectable Angular 5+ service for paginating an array.\n\n## Installation\n\nYou must have npm installed first.  Then, in the command line:\n\n```bash\nnpm install @writetome51/paginator-service\n```\n\n## Loading\n```\n// If using TypeScript:\nimport { PaginatorService } from '@writetome51/paginator-service';\n// If using ES5 JavaScript:\nvar PaginatorService = require('@writetome51/paginator-service').PaginatorService;\n```\n\n## Usage\n\n```\n// Injecting it into another class:\n\nexport class ExampleAngularComponent {\n\n    constructor(public paginatorSvc: PaginatorService) { ... }\n}\n\n// Assigning it a new array:  \npaginatorSvc.data = [item1, item2, item3, ...]\n\n// Changing number of items per page:  \npaginatorSvc.itemsPerPage = 15;\n\n// Getting a page:\nlet page = paginatorSvc.getPage(pageIndex);  // page indexes begin at 0.\n\n// Changing the current page, and then reading it:\npaginatorSvc.currentPageNumber += 1;\nlet currentPage = paginatorSvc.currentPage; \n\n// Getting the total number of pages:  \nlet totalPages = paginatorSvc.totalPages;\n\n// Getting the current page number:  \nlet currentPageNumber = paginatorSvc.currentPageNumber;\n```\n\n## Properties\n```\ndata : any[]\n    // the array being paginated.\n\nitemsPerPage : integer\n    // default is 25.\n\ncurrentPageNumber : integer\n    // Assigning this a value automatically causes this.currentPage to update.\n\ncurrentPage : any[] (read-only)\n    // all items to be shown on current page.\n\ntotalPages : integer (read-only)\n\nprotected  _currentPageNumber : integer (read-writable)\n    // available in case a subclass wants to use it.\n\nclassName : string (read-only)\n```\n\n## Methods\n```\ngetPage(pageIndex) : any[]\n    // returns a 'page' of items copied from this.data.\n    // Changes value of this.currentPageNumber to pageIndex + 1.\n    // Also changes value of this.currentPage.\n    // As an alternative to using this method, you can change the\n    // value of this.currentPageNumber and then get the value of\n    // this.currentPage.\n``` \nThe methods below are not important to know about in order to use this  \nclass.  They're inherited from [BaseClass](https://github.com/writetome51/typescript-base-class#baseclass) .\n\n```\nprotected   _createGetterAndOrSetterForEach(\n                  propertyNames: string[],\n                  configuration: IGetterSetterConfiguration\n            ) : void\n     /*********************\n     Use this method when you have a bunch of properties that need getter and/or \n     setter functions that all do the same thing. You pass in an array of string \n     names of those properties, and the method attaches the same getter and/or \n     setter function to each property.\n     IGetterSetterConfiguration is this object:\n     {\n         get_setterFunction?: (\n             propertyName: string, index?: number, propertyNames?: string[]\n         ) =\u003e Function,\n             // get_setterFunction takes the property name as first argument and \n             // returns the setter function.  The setter function must take one \n             // parameter and return void.\n     \n         get_getterFunction?: (\n             propertyName: string, index?: number, propertyNames?: string[]\n         ) =\u003e Function\n             // get_getterFunction takes the property name as first argument and \n             // returns the getter function.  The getter function must return something.\n     }\n     *********************/ \n   \n   \nprotected   _returnThis_after(voidExpression: any) : this\n    // voidExpression is executed, then function returns this.\n    // Even if voidExpression returns something, the returned data isn't used.\n\nprotected   _runMethod_and_returnThis(\n    callingObject, \n    method: Function, \n    methodArgs: any[], \n    additionalAction?: Function // takes the result returned by method as an argument.\n) : this\n```   \n\n## Inheritance Chain\n\nPaginatorService\u003c--[AppPaginator](https://github.com/writetome51/app-paginator#apppaginator)\u003c--[ArrayPaginator](https://github.com/writetome51/array-paginator#arraypaginator)\u003c--[PublicArrayContainer](https://github.com/writetome51/public-array-container#publicarraycontainer)\u003c--[BaseClass](https://github.com/writetome51/typescript-base-class#baseclass)\n\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwritetome51%2Fpaginator-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwritetome51%2Fpaginator-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwritetome51%2Fpaginator-service/lists"}