Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular2-cookie-law

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular2-cookie-law

Angular2 component that provides a banner to inform users about cookie law

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
811
decreased by-35.74%
Maintainers
1
Weekly downloads
 
Created
Source

Angular2 component that provides a banner to inform users about the cookie law

angular2-cookie-law is an HTML <cookie-law> tag enhanced with styling and animation

Table of contents

  • Installation
  • Setup
  • Usage
  • Example
  • Options
  • Contributing
  • Changelog
  • License

Installation

  1. Install the component using npm:
# To get the latest stable version and update package.json file:
npm install angular2-cookie-law --save

or yarn with:

yarn add angular2-cookie-law

Setup

If you are using system.js you may want to add this into map and package config:

{
  "map": {
      "angular2-cookie-law": "node_modules/angular2-cookie-law"
  },
  "packages": {
      "angular2-cookie-law": {
        "main": "index.js",
        "defaultExtension": "js"
      }
  }
}

If you are using Webpack you may want to add this into your vendor.js file:

// vendor.ts
import '@angular/platform-browser';
import '@angular/platform-browser-dynamic';
import '@angular/core';
import '@angular/common';
import '@angular/http';

// Third parties packages
import 'rxjs';
import 'angular2-cookie-law';

angular2-cookie-law class is an Angular2 module therefore, it needs to be registered in the modules array (encouraged way):

// app.module.ts
import { NgModule }            from '@angular/core';
import { BrowserModule }       from '@angular/platform-browser';
import { CookieLawModule }     from 'angular2-cookie-law';
import { AppComponent }        from './app.component';

@NgModule({
  declarations: [ AppComponent ],
  imports: [
    BrowserModule,
    CookieLawModule // import Angular's CookieLaw modules
  ],
  bootstrap: [ AppComponent ]
})
export class AppModule { }

Usage

Use the component anywhere around your application:

// app.component.ts
import { Component } from '@angular/core';

@Component({
  selector: 'app',
  template: `
    <cookie-law></cookie-law>
  `
})
export class AppComponent  { }

Example

// app.component.ts
import { Component } from '@angular/core';

@Component({
  selector: 'app',
  template: `
    <h1>
      Hello World!
    </h1>

    <cookie-law></cookie-law>
  `
})
export class AppComponent  { }
Output

cookie-law example

Options

learnMore

TypeDefault value
stringnull

If set to a valid absolute or relative URL, it will render an extra 'learn more' link pointing to the link.

eg.

<cookie-law learnMore="/learn-more"></cookie-law>
Output

output with link

target

TypeDefault value
string_blank

Set to _self if you want the external link not to be opened in a new tab.

eg.

<cookie-law learnMore="/learn-more" target="_self"></cookie-law>

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :sunglasses:

Changelog

Changelog available here

License

MIT License © Andrea SonnY

Keywords

FAQs

Package last updated on 31 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc