Tag input component for Angular 2
npm install angular2-tag-input --save
// In one of your application components
import {TagInputComponent} from 'angular2-tag-input';
@Component({
selector: 'your-component-selector',
directives: [TagInputComponent] // Add to directives
template: `<tag-input></tag-input>`
})
ngModel
:string[]
- Required Property to store the resulting tag list in.placeholder
:string
- Default:'Add a tag'
- Placeholder for the<input>
tag.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.