A new tag input, built for AngularJS
See the live demo page here.
Add the following files to your application:
<link rel="stylesheet" href="ngTagEditor.css" type="text/css"/>
<script type="text/javascript" src="http://cdn.jsdelivr.net/angularjs/1.2.17/angular.min.js"></script>
<script type="text/javascript" src="ngTagEditor.js"></script><tag-editor></tag-editor> In your html in any form.
It will add a hidden input <input type="hidden" name="tags"> containing added tags name, separated by a comma.
Add something like that to your javascript code:
var app = angular.module('app', ['ngTagEditor']);
app.controller('RandomController', function($scope, $http) {
$scope.tags = [
{name: 'See'},
{name: 'how'},
{name: 'amazing'},
{name: 'is'},
{name: 'AngularJS'}
];
});That goes with the following html:
<form ng-controller="RandomController">
<tag-editor ng-model="tags" output="name"></tag-editor>
</form>You can pass options by the following way: <tag-editor option="value"></tag-editor>.
First, give the URL of your API through the fetch option.
The data must be formated as follow, as stated this article.
{
"status": "success",
"data": [{
"id": "45",
"name": "Say"
}, {
"id": "23",
"name": "Hello"
}, {
"id": "68",
"name": "to"
}, {
"id": "77",
"name": "JSON"
}]
}See test.html
