Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/voltra/ngx-gdpr-guard
Angular library to use gdpr-guard as efficiently and easily as possible
https://github.com/voltra/ngx-gdpr-guard
angular angular-library gdpr-guard hacktoberfest
Last synced: about 8 hours ago
JSON representation
Angular library to use gdpr-guard as efficiently and easily as possible
- Host: GitHub
- URL: https://github.com/voltra/ngx-gdpr-guard
- Owner: Voltra
- License: mit
- Created: 2023-08-22T17:34:17.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-07-06T12:54:17.000Z (4 months ago)
- Last Synced: 2024-07-07T13:57:25.705Z (4 months ago)
- Topics: angular, angular-library, gdpr-guard, hacktoberfest
- Language: TypeScript
- Homepage:
- Size: 9.04 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ngx-gdpr-guard
Angular library to use [gdpr-guard](https://www.npmjs.com/package/gdpr-guard) as efficiently and easily as possible
## Installation
```bash
npm i -S ngx-gdpr-guard
```## Setup
You'll need both a `GdprManagerFactory` and a `GdprSavior`.
> NOTE: The recommended gdpr savior library is [`gdpr-guard-local`](https://www.npmjs.com/package/gdpr-guard-local) which uses local storage by default, but can be customized to use anything.
You can use a very basic `GdprManagerFactory` using the `GdprManagerBuilder` as follows:
```ts
import { GdprManagerBuilder, GdprManagerFactory } from "gdpr-guard";const managerFactory: GdprManagerFactory = () => GdprManagerBuilder.make()
/* [...] */
.build();
```There's an injection token for both the factory and the savior:
```ts
import { GDPR_MANAGER_FACTORY_TOKEN, GDPR_SAVIOR_TOKEN } from "ngx-gdpr-guard";const providers = [
{ provide: GDPR_MANAGER_FACTORY_TOKEN, /* [...] */ },
{ provide: GDPR_SAVIOR_TOKEN, /* [...] */ },
];
```With these providers in scope, you can inject the `NgxGdprGuardService`:
```ts
import { NgModule } from "@angular/core";
import { NgxGdprGuardService } from "ngx-gdpr-guard";@NgModule({
declarations: [],
imports: [],
exports: [],
})
export class MyModule {
constructor(private ngxGdprGuard: NgxGdprGuardService) {
}
}
```