Code Monkey home page Code Monkey logo

ngx-tags-input's Introduction

ngx-tags-input

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

Key Default Remarks
ngModel N/A The variable you whish to bind your tags to. Must be an Array
removeLastOnBackspace false Boolean indicating that you can remove the last tag in the row when you press backspace in the input area when it is empty
canDeleteTags true Boolean indicating wether tags can be removed or not
placeholder '' Placeholder text to display when not tags are present
maxTags N/A maximum number tags allowed to select
options N/A List 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
minLengthBeforeOptions 1 The length of the typed string before the dropdown is shown. Putting this to 0 will display it on focus
scrollableOptions false Boolean indicator wether the user can scroll in the dropdown
scrollableOptionsInView 5 Amount of options shown in the view when the dropdown is scrollable
onNoOptionsMatch N/A Will be called on every keystroke. $event will be true when none of the given options match the entered text
onTagsChanged N/A Will 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
onMaxTagsReached N/A Will be called when the maximum amount of tags has been reached

Development

To generate all the necessary files:

$ npm run ngc

To lint all *.ts files:

$ npm run lint

License

MIT © Maarten Schroeven

ngx-tags-input's People

Contributors

bily-amin avatar sonaryr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.