var app = angular.module('plunker', ['ngTagsInput']);
app.config(function(tagsInputConfigProvider) {
tagsInputConfigProvider
.setActiveInterpolation('tagsInput', { placeholder: true });
});
app.controller('MainCtrl', function($scope) {
var maxTags = 5;
$scope.$watch('tags.length', function(value) {
if (value < maxTags)
$scope.placeholder = 'Add ' + (maxTags - value) + ' tags';
else
$scope.placeholder = 'No more tags!';
});
});
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script>document.write('<base href="' + document.location + '" />');</script>
<link rel="stylesheet" href="http://mbenford.github.io/ngTagsInput/css/ng-tags-input.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script>
<script src="http://mbenford.github.io/ngTagsInput/js/ng-tags-input.min.js"></script>
<script src="app.js"></script>
</head>
<body ng-controller="MainCtrl">
<tags-input ng-model="tags" placeholder="{{placeholder}}"></tags-input>
<p>Model: {{tags}}</p>
</body>
</html>