{"id":31755331,"url":"https://github.com/gustavocostaw/ngc-pagination","last_synced_at":"2025-10-09T18:44:41.507Z","repository":{"id":73927569,"uuid":"96349301","full_name":"GustavoCostaW/ngc-pagination","owner":"GustavoCostaW","description":"Simple pagination for Angular v4+ Demo: http://bit.ly/2xHWXWR","archived":false,"fork":false,"pushed_at":"2017-10-15T18:47:22.000Z","size":41,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-14T20:01:19.964Z","etag":null,"topics":["angular","pagination","pagination-components"],"latest_commit_sha":null,"homepage":"","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/GustavoCostaW.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":"2017-07-05T18:27:27.000Z","updated_at":"2018-09-04T12:28:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"9dba5100-0414-46f8-9586-eaa56f5e99d2","html_url":"https://github.com/GustavoCostaW/ngc-pagination","commit_stats":{"total_commits":41,"total_committers":2,"mean_commits":20.5,"dds":"0.024390243902439046","last_synced_commit":"3d16fbae36e686fc2fb16cd8f219212f5bfd0cb4"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GustavoCostaW/ngc-pagination","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GustavoCostaW%2Fngc-pagination","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GustavoCostaW%2Fngc-pagination/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GustavoCostaW%2Fngc-pagination/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GustavoCostaW%2Fngc-pagination/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GustavoCostaW","download_url":"https://codeload.github.com/GustavoCostaW/ngc-pagination/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GustavoCostaW%2Fngc-pagination/sbom","scorecard":{"id":60054,"data":{"date":"2025-08-11","repo":{"name":"github.com/GustavoCostaW/ngc-pagination","commit":"3d16fbae36e686fc2fb16cd8f219212f5bfd0cb4"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-15T01:30:07.290Z","repository_id":73927569,"created_at":"2025-08-15T01:30:07.290Z","updated_at":"2025-08-15T01:30:07.290Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001883,"owners_count":26083226,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","pagination-components"],"created_at":"2025-10-09T18:44:38.546Z","updated_at":"2025-10-09T18:44:41.498Z","avatar_url":"https://github.com/GustavoCostaW.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ngc-pagination\n\nSimple pagination for Angular v4+\n\n![](http://g.recordit.co/hMI2hoTtG7.gif)\n\n## [`Demo`](http://bit.ly/2xHWXWR)\n\n## Installation\n\nFirst you need to install the npm module:\n\n```sh\nnpm install ngc-pagination --save\n```\n\n## Usage\n\n#### 1. Import the `NgcPaginationModule`:\n\nFinally, you can use `ngc-pagination` in your Angular project.\n\n```ts\nimport {BrowserModule} from '@angular/platform-browser';\nimport {NgModule} from '@angular/core';\nimport {NgcPaginationModule} from 'ngc-pagination';\n\n@NgModule({\n    imports: [\n        BrowserModule,\n        NgcPaginationModule\n    ],\n    bootstrap: [AppComponent]\n})\nexport class AppModule { }\n```\n\n##### SharedModule\n\nIf you use a [`SharedModule`](https://angular.io/docs/ts/latest/guide/ngmodule.html#!#shared-modules) that you import in multiple other feature modules,\nyou can export the `NgcPaginationModule` to make sure you don't have to import it in every module.\n\n```ts\n@NgModule({\n    exports: [\n        CommonModule,\n        NgcPaginationModule\n    ]\n})\nexport class SharedModule { }\n```\n\n## Sample\n\n1 - Configure the pagination\n\n```Typescript\n\n    import { NgcPaginationModel } from 'ngc-pagination';\n    import { BehaviorSubject } from 'rxjs/BehaviorSubject';\n\n    /*\n\n    @Component({ ... });\n\n    */\n\n    export class MyComponent {\n\n        private paginationConfig: BehaviorSubject\u003cNgcPaginationModel\u003e;\n\n        constructor() {\n            createPagination();\n        }\n\n        // pagination config to send to component\n        createPagination() {\n            this.paginationConfig = new BehaviorSubject({\n                totalItens: 300, // required\n                itensPerPage: 10, // 10 is the default\n                currentPage: 1, // 1 is the default\n                range: 10, // 10 is the default\n                change_after: false, // false is the default,\n                disabledWhenChange: false // false is the default\n            });\n        }\n\n        // to listener ngc-pagination events.\n        events(event) {\n            console.log(event);\n        }\n    }\n\n```\n\n\n2 - The pagination template\n\n```HTML\n\u003cngc-pagination #pagination\n     [config]=\"paginationConfig\"\n     (paginationEvents)=\"events($event)\"\u003e\n\n     \u003c!--\n\n        Note the `#pagination` template variable above is used in the html below to get the component reference, you can change to any name.\n\n\n        WARNING, I'm using the Angular Material buttons with mat-button directive and \u003cmat-icon\u003e\n          component to show icons in this template, if you're not using the Angular Material in your\n          project you need to remove the all directives mat-button in all \u003cbutton\u003e tags below and also\n          remove all \u003cmat-icon\u003e components.\n\n     --\u003e\n\n      \u003cbutton mat-button\n      (click)=\"pagination.goTo('firstPage')\"\n      [disabled]=\"pagination.config.getValue().currentPage \u003c= 1 || pagination.buttonsDisabled\"\u003e\n        \u003cmat-icon\u003e\n          first_page\n        \u003c/mat-icon\u003e\n      \u003c/button\u003e\n\n      \u003cbutton mat-button\n      (click)=\"pagination.goTo('prevPage')\"\n      [disabled]=\"pagination.config.getValue().currentPage \u003c= 1 || pagination.buttonsDisabled\"\u003e\n        \u003cmat-icon\u003e\n          chevron_left\n        \u003c/mat-icon\u003e\n      \u003c/button\u003e\n\n      \u003cbutton class=\"page\" mat-button\n      *ngFor=\"let page of pagination.config.getValue().exibition\"\n      [class.active]=\"page === pagination.config.getValue().currentPage\"\n      [disabled]=\"pagination.buttonsDisabled\"\n      (click)=\"page !== pagination.config.getValue().currentPage ? pagination.goTo('pageChanged', page) : undefined\"\u003e\n        {{page}}\n      \u003c/button\u003e\n\n      \u003cbutton mat-button\n      (click)=\"pagination.goTo('nextPage')\"\n      [disabled]=\"pagination.config.getValue().currentPage \u003e= pagination.config.getValue().totalPages || pagination.buttonsDisabled\"\u003e\n        \u003cmat-icon\u003e\n          chevron_right\n        \u003c/mat-icon\u003e\n      \u003c/button\u003e\n\n      \u003cbutton mat-button (click)=\"pagination.goTo('lastPage')\"\n      [disabled]=\"pagination.config.getValue().currentPage \u003e= pagination.config.getValue().totalPages || pagination.buttonsDisabled\"\u003e\n        \u003cmat-icon\u003e\n          last_page\n        \u003c/mat-icon\u003e\n      \u003c/button\u003e\n\u003c/ngc-pagination\u003e\n```\n\nWell, with only that you can see this result:\n\n![](http://g.recordit.co/a40l3UuTQe.gif)\n\n\nCool! Now your `BehaviorSubject` you can emit events and the `ngc-pagination` will react the property changes.\n\nYou can change the `currentPage` anytime\n\n```Typescript\n\n      this.paginationConfig.next({\n        ...this.paginationConfig.getValue(), // with this you're reusing the active properties like totalItens, range...\n        currentPage: event.goTo // you only change the currentPage property\n      })\n\n```\n\nIf you need to change the pagination range\n\n```Typescript\n      this.paginationConfig.next({\n        ...this.paginationConfig.getValue(), //reusing the values...\n        range: 5 // change only range property\n      })\n```\n\n## API\n\n`change_after` property when is true, all user events isn't applied into the view when the\ncurrent page is changed. A good example of your usage is if you want to update the current\npage in the UI when the request is done for example.\n\nSample:\n\nIf `change_after` property is `true` the view is updated after 2s 'simulating a request'\n\n```Typescript\n\n      createPagination() {\n          this.paginationConfig = new BehaviorSubject({\n              totalItens: 300,\n              change_after: true\n          });\n      }\n\n      // passing (paginationEvents)=\"events($event)\" to listener ngc-pagination events\n      events(event) {\n        // simulate request\n        setTimeout( () =\u003e {\n\n          // update the currentPage UI only when the 'simulate request is back' after 2s\n          this.paginationConfig.next({\n            ...this.paginationConfig.getValue(),  // get initial values\n            currentPage: event.goTo\n          })\n\n        },2000);\n      }\n```\n\nSee the behavior below when that code run:\n\n![](http://g.recordit.co/69wMYPL8qj.gif)\n\n\n`disabledWhenChange` property when is true, any button is clicked, all buttons is disabled\nand the pagination wait for the `next()` method to enable buttons\n\nSample:\n\n```Typescript\n  createPagination() {\n    this.paginationConfig = new BehaviorSubject({\n        totalItens: 300,\n        change_after: true,\n        disabledWhenChange: true\n    });\n\n      // passing (paginationEvents)=\"events($event)\" to listener ngc-pagination events\n      events(event) {\n        // simulate request\n        setTimeout( () =\u003e {\n          // simulate send new values\n          this.paginationConfig.next({\n            ...this.paginationConfig.getValue(), // get the first values\n            currentPage: event.goTo\n          })\n\n        },1000);\n      }\n}\n```\nSee the behavior below when that code run:\n\n![](http://g.recordit.co/edCW9GNta4.gif)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgustavocostaw%2Fngc-pagination","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgustavocostaw%2Fngc-pagination","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgustavocostaw%2Fngc-pagination/lists"}