0.7.1 • Published 7 years ago

ng2-tags-input v0.7.1

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

ng2-tags-input

RENAMED TO ngx-tags-input

You can find the new package here. Also al further devolpment will be done there.

Disclaimer

This package is still under active development and might undergo heavy (breaking) changes. please be aware of this when using it.

Installation

To install this library, run:

$ npm install ngx-tags-input --save

Consuming the library

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

// Import the library
import { TagsInputModule } from 'ngx-tags-input/dist';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,

    // Specify the library as an import
    TagsInputModule.forRoot()
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Once the library is imported, you can use it in your code

...
<tags-input class="form-control input-lg" (onTagsChanged)="onTagsChanged($event)" [removeLastOnBackspace]="removeLastOnBackspace" [(ngModel)]="tags" name="tags"></tags-input>
...

API

KeyDefaultRemarks
ngModelN/AThe variable you whish to bind your tags to. Must be an Array
onTagsChangedN/AWill be called when a change is made to the tags $event will have the following structure: {change: 'add', tag: {}} where change can be add or remove
onMaxTagsReachedN/AWill be called when the maximum amount of tags has been reached
removeLastOnBackspacefalseBoolean indicating that you can remove the last tag in the row when you press backspace in the input area when it is empty
canDeleteTagstrueBoolean indicating wether tags can be removed or not
placeholder''Placeholder text to display when not tags are present
maxTagsN/Amaximum number tags allowed to select
optionsN/AList of selectable options to add via the typeahead. Can be Array of strings, objects or an Observable for external matching process
displayField'displayValue'Name of the property to show in the dropdown
onNoOptionsMatchN/AWill be called on every keystroke. $event will be true when none of the given options match the entered text

Development

To generate all the necessary files:

$ npm run ngc

To lint all *.ts files:

$ npm run lint

License

MIT © Maarten Schroeven

0.7.1

7 years ago

0.7.0

7 years ago

0.6.0

7 years ago

0.5.4

7 years ago

0.5.3

7 years ago

0.5.2

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.4.2

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.0.0-alpha.1

7 years ago