{"id":15611698,"url":"https://github.com/patrickvaler/ng-vote","last_synced_at":"2025-04-28T12:21:29.304Z","repository":{"id":57310760,"uuid":"91854516","full_name":"patrickvaler/ng-vote","owner":"patrickvaler","description":"🚀 Simple \u0026 lightweight Angular 2/4 vote component","archived":false,"fork":false,"pushed_at":"2018-08-19T12:22:56.000Z","size":146,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T20:16:11.199Z","etag":null,"topics":["angular","angular2","typescript","vote","voter"],"latest_commit_sha":null,"homepage":"https://plnkr.co/edit/Gz4LszNzdUfWYe1bLoGA?p=preview","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/patrickvaler.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-20T00:18:39.000Z","updated_at":"2018-05-31T17:56:44.000Z","dependencies_parsed_at":"2022-08-26T06:21:29.202Z","dependency_job_id":null,"html_url":"https://github.com/patrickvaler/ng-vote","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickvaler%2Fng-vote","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickvaler%2Fng-vote/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickvaler%2Fng-vote/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickvaler%2Fng-vote/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patrickvaler","download_url":"https://codeload.github.com/patrickvaler/ng-vote/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251311340,"owners_count":21569011,"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","angular2","typescript","vote","voter"],"created_at":"2024-10-03T06:06:59.886Z","updated_at":"2025-04-28T12:21:29.281Z","avatar_url":"https://github.com/patrickvaler.png","language":"TypeScript","readme":"[![npm version](https://badge.fury.io/js/ng-vote.svg)](http://badge.fury.io/js/ng-vote) [![Build Status](https://travis-ci.org/patrickvaler/ng-vote.svg?branch=master)](https://travis-ci.org/patrickvaler/ng-vote) [![Dependency Status](https://david-dm.org/patrickvaler/ng-vote/status.svg?style=flat)](https://david-dm.org/patrickvaler/ng-vote)\n\n\nng-vote\n=======\n\nSimple \u0026 lightweight Angular 2/4 voting component. Demo is available on [Plunker][plunkerDemo].\n\n![ng-vote demo][demo]\n\n## Installation\n\nTo install ng-vote, run:\n\n```bash\n$ npm install ng-vote --save\n```\n\n## Usage\nImport `NgVoteModule` into your Angular application:\n\n```typescript\n\n// Import ng-vote\nimport { NgVoteModule } from 'ng-vote';\n\n@NgModule({\n  declarations: [\n    AppComponent\n  ],\n  imports: [\n    BrowserModule,\n    // Specify ng-vote as an import\n    NgVoteModule\n  ],\n  providers: [],\n  bootstrap: [AppComponent]\n})\nexport class AppModule { }\n```\n\nOnce ng-vote is imported, you can use it in your Angular application:\n\n```typescript\n\nimport { Component } from '@angular/core';\n\n@Component({\n  selector: 'app-root',\n  templateUrl: './app.component.html',\n  styleUrls: ['./app.component.css']\n})\nexport class AppComponent {\n    voteConfig: {\n      cssClass: 'my-class',\n      allowEdit: true, \n      disabled: false\n    }\n    votes: 123, // total amount of votes\n    selectedVote: 0 // not voted yet\n\n  onVote(vote) {\n    console.log('onVote response: ', vote)\n  }\n}\n```\n\n```html\n\u003c!-- You can now use ng-vote component in your application --\u003e\n\u003cng-vote \n  (vote)=\"onVote($event)\" \n  [totalVotes]=\"votes\" \n  [selectedVote]=\"selectedVote\" \n  [config]=\"voteConfig\"\u003e\n    \u003c!-- Define Up Vote Button --\u003e\n    \u003cng-vote-up\u003e\n      \u003c!-- Content will be projected --\u003e\n      \u003ci class=\"my-up-icon\"\u003e\u003c/i\u003eUp\n    \u003c/ng-vote-up\u003e\n    \u003c!-- Add Down Vote Button --\u003e\n    \u003cng-vote-down\u003eDown\u003c/ng-vote-down\u003e\n\u003c/ng-vote\u003e \n\n\u003c!-- Minimal setup would be --\u003e\n\u003cng-vote (vote)=\"onVote($event)\"\u003e\n    \u003cng-vote-up\u003eUp\u003c/ng-vote-up\u003e\n    \u003cng-vote-down\u003eDown\u003c/ng-vote-down\u003e\n\u003c/ng-vote\u003e\n```\n\n## Bindings\n### ng-vote\n#### @Input\n\n* **[totalVotes]**: number `Default: 0`\n* **[selectedVote]**: number `Default: 0`\n_One of -1 (downVote), 0 (not voted), 1 (upVote)_\n* **[config]**: Object\n    * **allowEdit**: boolean `Default: true`\n        _Defines if user is allowed to change his the selection._\n    * **disabled**: boolean `Default: false`\n        _Disables vote functionality._\n    * **cssClass**: string `Default: ''`\n        _Sets custom css class to override styles._\n        \n        \n#### @Output\n* **(vote)**: Object\n    * **selectedVote**: number\n    * **totalVotes**: number\n\n### ng-vote-up / ng-vote-down\nNo bindings available for `\u003cng-vote-up\u003e` / `\u003cng-vote-down\u003e`. Content will be projected to the `\u003cbutton\u003e`.\n\n## Demo\nDemo of the Angular 2/4 voting component is available on [Plunker][plunkerDemo].\n\n## License\n\n*The MIT License (MIT)*\n\nCopyright (c) 2017 Patrick Valer\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n---\nMade with ♥ by [Patrick Valer][patrickvalerCh] (\u003chello@patrickvaler.ch\u003e)\n\n[patrickvalerCh]: https://www.patrickvaler.ch \"patrickvaler.ch\"\n[plunkerDemo]: https://plnkr.co/edit/Gz4LszNzdUfWYe1bLoGA?p=preview \"ng-vote demo on Plunker\"\n[demo]: https://image.ibb.co/niY4kv/ng_vote_demo.gif \"ng-vote demo\"\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickvaler%2Fng-vote","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrickvaler%2Fng-vote","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickvaler%2Fng-vote/lists"}