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

ng2-tagsinput

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng2-tagsinput

Typescript component for Tag Input

  • 0.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
27
increased by35%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

Angular 2 : Typescript component for Tags Input

An improved version of angular2-tag-input

Installation

Install it from npm:

npm install ng2-tagsinput

Usage

SystemJS config

System.config({
    ...
    map: {
      ...
      'ng2-tagsinput': 'node_modules/ng2-tagsinput',
      ...
    }
    ...
    packages: {
      ...
      'ng2-tagsinput': { defaultExtension: 'js', main:'index' }
      ...
    }
    ...
});

Module

import {Ng2TagsInputModule} from 'ng2-tagsinput';
 ...
 @NgModule({
   imports: [...,Ng2TagsInputModule]
   })
  ...

View

Use in template like below

<tag-input
placeholder="Add tags ..."
[model]="tagsArray"
(tagsChanged)="onTagsChange($event)"
(tagsAdded)="onTagsAdded($event)"
(tagRemoved)="onTagRemoved($event)"
>

Where model is the array of elements which will have the resulting tags list. tagsChanged is fired whenever tags list changes i.e. tags are added or removed.

Inputs

  • model : string[] - Model you want the tags list to bind to.
  • placeholder : string - Default: 'Add a tag' - Placeholder for the <input> tag.
  • disabled : boolean - Default: 'false' - Disables ability to add/remove tags.
  • delimiterCode : Array<number> - Default: '[188]' - Array of ASCII keycodes to split tags on. Defaults to comma.
  • addOnBlur : boolean - Default: true - Whether to attempt to add a tag when the input loses focus.
  • addOnEnter : boolean - Default: true - Whether to attempt to add a tag when the user presses enter.
  • addOnPaste : boolean - Default: true - Whether to attempt to add a tags when the user pastes their clipboard contents.
  • allowedTagsPattern : RegExp - Default: /.+/ - RegExp that must match for a tag to be added.

Outputs(Events)

  • tagsChanged : string[] - Fires when tags list is changed in any way.
  • tagsAdded : string[] - Fires when tags are added.
  • tagRemoved : string[] - Fires when tag is removed.

Keywords

FAQs

Package last updated on 29 May 2017

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