-
Notifications
You must be signed in to change notification settings - Fork 0
/
angular-bootstrap-tokenfield.js
34 lines (32 loc) · 1.17 KB
/
angular-bootstrap-tokenfield.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(function () {
'use strict';
// Register module
var myModule = angular.module('angularTokenfield', []);
// Define directive
myModule.directive ('angularBootstrapTokenfield', function() {
return {
restrict: 'A',
scope: {
'tokens': '=tokens',
'limit': '=limit',
'minLength': '=minLength',
'minWidth': '=minWidth',
'showAutocompleteOnFocus': '=showAutocompleteOnFocus',
'autocomplete': '=autocomplete',
'createTokensOnBlur': '=createTokensOnBlur',
'delimiter': '=delimiter',
'beautify': '=beautify',
'inputType': '=inputType'
},
link: function(scope, element, attrs) {
element.tokenfield(scope)[0];
scope.original = element[0]
scope.tokenInput = element.siblings('.token-input')[0];
scope.tokenInput.placeholder = '';
scope.$watch(function(){
scope.tokenInput.placeholder = scope.original.placeholder;
});
}
}
});
})();