{"id":27880520,"url":"https://github.com/KoblerS/ngx-gdpr-cookie-consent","last_synced_at":"2025-05-05T04:03:12.919Z","repository":{"id":97846173,"uuid":"573853959","full_name":"KoblerS/ngx-gdpr-cookie-consent","owner":"KoblerS","description":"A beautiful Cookie 🍪 consent library, easy to use. ","archived":false,"fork":false,"pushed_at":"2025-05-02T11:37:37.000Z","size":832,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-02T11:51:38.619Z","etag":null,"topics":["angular","cookieconsent","dependency","gdpr"],"latest_commit_sha":null,"homepage":"https://koblers.github.io/ngx-gdpr-cookie-consent/","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/KoblerS.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":"2022-12-03T16:37:21.000Z","updated_at":"2025-05-02T11:37:02.000Z","dependencies_parsed_at":"2023-11-21T09:26:38.917Z","dependency_job_id":"4d49d50b-be84-4cac-8e74-08ae46e02286","html_url":"https://github.com/KoblerS/ngx-gdpr-cookie-consent","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KoblerS%2Fngx-gdpr-cookie-consent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KoblerS%2Fngx-gdpr-cookie-consent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KoblerS%2Fngx-gdpr-cookie-consent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KoblerS%2Fngx-gdpr-cookie-consent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KoblerS","download_url":"https://codeload.github.com/KoblerS/ngx-gdpr-cookie-consent/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252436291,"owners_count":21747470,"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","cookieconsent","dependency","gdpr"],"created_at":"2025-05-05T04:02:23.235Z","updated_at":"2025-05-05T04:03:12.909Z","avatar_url":"https://github.com/KoblerS.png","language":"TypeScript","funding_links":[],"categories":["Recently Updated","Third Party Components"],"sub_categories":["[May 05, 2025](/content/2025/05/05/README.md)","Cookies"],"readme":"\n# ngx-gdpr-cookie-consent\n\n[![npm version](https://badge.fury.io/js/ngx-gdpr-cookie-consent.svg)](https://badge.fury.io/js/ngx-gdpr-cookie-consent)\n\n## Demo\n\nView the module in action at https://KoblerS.github.io/ngx-gdpr-cookie-consent\n\n## Installation\n\nInstall `Ngx Cookie Consent` dependency:\n\n```shell\nnpm install --save ngx-gdpr-cookie-consent\n```\n\n## Usage\n\n1. Import the `NgxGdprCookieConsentModule` and define all cookie types:\n\nFinally, you can use ngx-gdpr-cookie-consent in your Angular project. You have to import `NgxGdprCookieConsentModule.forRoot()` in the root NgModule of your application.\n\nThe forRoot static method is a convention that provides and configures services at the same time. Make sure you only call this method in the root module of your application, most of the time called AppModule. This method allows you to configure the NgxGdprCookieConsentModule by specifying different cookie types.\n\nHere is an example how to configure 2 different cookie definitions:\n\n```typescript\nimport {NgModule} from '@angular/core';\nimport {NgxGdprCookieConsentModule} from '@ngx-gdpr-cookie-consent';\nimport { BrowserAnimationsModule } from '@angular/platform-browser/animations';\n\n@NgModule({\n    imports: [\n        BrowserAnimationsModule,\n        NgxGdprCookieConsentModule.forRoot({\n          cookieTypes: [\n            {\n              id: 'essential',\n              name: 'Essential cookies',\n              description: 'Essential cookies are required in order to guarantee app stability',\n              disabled: true,\n              selected: true\n            },\n            {\n              id: 'external',\n              name: 'External Services',\n              description: 'External services help us to delivery customer experience',\n              scripts: [\n                'https://maps.googleapis.com/maps/api/js?libraries=places\u0026key=mymapskey'\n              ]\n            }\n          ]\n      })\n    ],\n    bootstrap: [AppComponent]\n})\nexport class AppModule { }\n```\n\n2. Add the cookie consent component to your `app.component.ts`:\n\n```html\n\u003ccookie-consent [config]=\"config\"\u003e\u003c/cookie-consent\u003e\n```\n\n```typescript\nimport { Component, ViewChild } from '@angular/core';\nimport { NgxGdprCookieConsentConfig } from 'projects/ngx-gdpr-cookie-consent/src/lib/model/common-types';\n\n@Component({\n  selector: 'app-root',\n  templateUrl: './app.component.html',\n  styleUrls: ['./app.component.scss']\n})\nexport class AppComponent {\n\n  config: NgxGdprCookieConsentConfig = {\n    image: 'assets/images/cookie.png',\n    legalLinks: [\n      {\n        name: 'TOS',\n        url: '#'\n      }\n    ]\n  };\n}\n```\n\n## Show content based on decision\n\nThis will show the inner container only if cookieId `external` has been consented\n\n```html\n\u003ccookie-container cookieId=\"external\"\u003e\n  \u003ciframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/dQw4w9WgXcQ\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen\u003e\u003c/iframe\u003e\n\u003c/cookie-container\u003e\n```\n\n## Contributing\n\nThis project has a maintainer that actively monitors its issue queue and responds in a timely manner. This means that bug reports, tasks, feature requests and support request posted in the project's issue should receive timely attention from project's maintainers. Other community members are also welcome to resolve issues posted to the issue queue.\n\n## License\n\nngx-gdpr-cookie-consent is licensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKoblerS%2Fngx-gdpr-cookie-consent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKoblerS%2Fngx-gdpr-cookie-consent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKoblerS%2Fngx-gdpr-cookie-consent/lists"}