ngTagsInput

Tags input directive for AngularJS
43 people use it
Author: 446867?v=3 mbenford

ngTagsInput

Travis Coveralls David GitHub release Gratipay

Tags input directive for AngularJS. Check out the ngTagsInput website for more information.

Requirements

  • AngularJS 1.3+
  • A modern browser (Chrome 31+, Firefox 29+, Safari 7+, Opera 12+, IE 10+)

Installing

The first step is to get the files. You have 4 options:

  • Download the files manually from the Releases page.
  • Use Bower to download the files. Just run bower install ng-tags-input.
  • Load the files from CDNJS.
  • Get the latest build* generated by Travis.

* The latest build is based on the master branch and contains the most recent features and bugfixes.

Now all you have to do is add the scripts to your application. Just make sure the ng-tags-input.js file is inserted after the angular.js script:

Usage

  1. Add the ngTagsInput module as a dependency in your AngularJS app;
  2. Add the custom directive <tags-input> to the HTML file where you want to use an input tag control and bind it to a property of your model. That property, if it exists, must be an array of objects and each object must have a property named text containing the tag text;
  3. Set up the options that make sense to your application;
  4. Enable autocomplete, if you want to use it, by adding the directive <auto-complete> inside the <tags-input> tag, and bind it to a function of your model. That function must return either an array of objects or a promise that eventually resolves to an array of objects (same rule from step 2 applies here);
  5. Customize the CSS classes, if you want to.
  6. You're done!

Note: There's a more detailed getting started guide on the ngTagsInput website.

Options

Check out the documentation page for a detailed view of all available options.

Demo

You can see the directive in action in the demo page.

Contributing

Before posting an issue or sending a pull request, make sure to read the CONTRIBUTING file.

License

See the LICENSE file.

Changelog

See the CHANGELOG page.

Alternatives

The following are some alternatives to ngTagsInput you may want to check out:

  • angular-tags: Pure AngularJS tagging widget with typeahead support courtesy of ui-bootstrap
  • angular-tagger: Pure Angular autocomplete with tags, no jQuery
  • jsTag: Open source project for editing tags (aka tokenizer) based on AngularJS
  • bootstrap-tagsinput: jQuery plugin providing a Twitter Bootstrap user interface for managing tags (provides Angular support)
comments powered by Disqus
This page was last updated about 2 years ago.