diff --git a/.jshintrc b/.jshintrc index d21b03ef..c2e94123 100644 --- a/.jshintrc +++ b/.jshintrc @@ -22,6 +22,7 @@ "jasmine": true, "spyOn": true, "require": true, + "tagsInput": true, "KEYS": true } } \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index c3d4b146..c17363ee 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -59,6 +59,9 @@ module.exports = function(grunt) { url: function(url) { return 'ngTagsInput/' + url.replace('templates/', ''); }, + bootstrap: function(module, script) { + return 'tagsInput.run(function($templateCache) {\n' + script + '});\n'; + }, htmlmin: { collapseWhitespace: true, removeRedundantAttributes: true diff --git a/build/ng-tags-input.js b/build/ng-tags-input.js index 82045878..4ff1ea57 100644 --- a/build/ng-tags-input.js +++ b/build/ng-tags-input.js @@ -12,7 +12,7 @@ var KEYS = { comma: 188 }; -angular.module('tags-input', []); +var tagsInput = angular.module('tags-input', []); /** * @ngdoc directive @@ -40,7 +40,7 @@ angular.module('tags-input', []); * @param {expression} onTagAdded Expression to evaluate upon adding a new tag. The new tag is available as $tag. * @param {expression} onTagRemoved Expression to evaluate upon removing an existing tag. The removed tag is available as $tag. */ -angular.module('tags-input').directive('tagsInput', ["$timeout","$document","configuration", function($timeout, $document, configuration) { +tagsInput.directive('tagsInput', ["$timeout","$document","configuration", function($timeout, $document, configuration) { function SimplePubSub() { var events = {}; @@ -265,7 +265,7 @@ angular.module('tags-input').directive('tagsInput', ["$timeout","$document","con * suggestions list. * @param {number=} [maxResultsToShow=10] Maximum number of results to be displayed at a time. */ -angular.module('tags-input').directive('autoComplete', ["$document","$timeout","$sce","configuration", function($document, $timeout, $sce, configuration) { +tagsInput.directive('autoComplete', ["$document","$timeout","$sce","configuration", function($document, $timeout, $sce, configuration) { function SuggestionList(loadFn, options) { var self = {}, debouncedLoadId, getDifference; @@ -450,7 +450,6 @@ angular.module('tags-input').directive('autoComplete', ["$document","$timeout"," } }; }]); -(function() { /** * @ngdoc directive @@ -459,7 +458,7 @@ angular.module('tags-input').directive('autoComplete', ["$document","$timeout"," * @description * Re-creates the old behavior of ng-transclude. */ -angular.module('tags-input').directive('transcludeAppend', function() { +tagsInput.directive('transcludeAppend', function() { return function(scope, element, attrs, ctrl, transcludeFn) { transcludeFn(function(clone) { element.append(clone); @@ -467,9 +466,6 @@ angular.module('tags-input').directive('transcludeAppend', function() { }; }); -}()); -(function() { - /** * @ngdoc service * @name tagsInput.service:configuration @@ -477,7 +473,7 @@ angular.module('tags-input').directive('transcludeAppend', function() { * @description * Loads and initializes options from HTML attributes. Used internally for tagsInput and autoComplete directives. */ -angular.module('tags-input').service('configuration', ["$interpolate", function($interpolate) { +tagsInput.service('configuration', ["$interpolate", function($interpolate) { this.load = function(scope, attrs, options) { var converters = {}; converters[String] = function(value) { return value; }; @@ -496,9 +492,7 @@ angular.module('tags-input').service('configuration', ["$interpolate", function( }; }]); -}()); - -angular.module('tags-input').run(['$templateCache', function($templateCache) { +tagsInput.run(["$templateCache", function($templateCache) { $templateCache.put('ngTagsInput/tags-input.html', "
" @@ -507,7 +501,6 @@ angular.module('tags-input').run(['$templateCache', function($templateCache) { $templateCache.put('ngTagsInput/auto-complete.html', "
" ); - }]); }()); \ No newline at end of file diff --git a/build/ng-tags-input.min.zip b/build/ng-tags-input.min.zip index d4d8b298..4127e2d3 100644 Binary files a/build/ng-tags-input.min.zip and b/build/ng-tags-input.min.zip differ diff --git a/build/ng-tags-input.zip b/build/ng-tags-input.zip index a7dc5eb7..d3cfd66b 100644 Binary files a/build/ng-tags-input.zip and b/build/ng-tags-input.zip differ diff --git a/src/auto-complete.js b/src/auto-complete.js index 111f0fec..b0ee545f 100644 --- a/src/auto-complete.js +++ b/src/auto-complete.js @@ -17,7 +17,7 @@ * suggestions list. * @param {number=} [maxResultsToShow=10] Maximum number of results to be displayed at a time. */ -angular.module('tags-input').directive('autoComplete', function($document, $timeout, $sce, configuration) { +tagsInput.directive('autoComplete', function($document, $timeout, $sce, configuration) { function SuggestionList(loadFn, options) { var self = {}, debouncedLoadId, getDifference; diff --git a/src/configuration.js b/src/configuration.js index 95646472..b889b882 100644 --- a/src/configuration.js +++ b/src/configuration.js @@ -1,4 +1,3 @@ -(function() { 'use strict'; /** @@ -8,7 +7,7 @@ * @description * Loads and initializes options from HTML attributes. Used internally for tagsInput and autoComplete directives. */ -angular.module('tags-input').service('configuration', function($interpolate) { +tagsInput.service('configuration', function($interpolate) { this.load = function(scope, attrs, options) { var converters = {}; converters[String] = function(value) { return value; }; @@ -26,5 +25,3 @@ angular.module('tags-input').service('configuration', function($interpolate) { }); }; }); - -}()); diff --git a/src/tags-input.js b/src/tags-input.js index b22dd1c5..b6009cb2 100644 --- a/src/tags-input.js +++ b/src/tags-input.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('tags-input', []); +var tagsInput = angular.module('tags-input', []); /** * @ngdoc directive @@ -28,7 +28,7 @@ angular.module('tags-input', []); * @param {expression} onTagAdded Expression to evaluate upon adding a new tag. The new tag is available as $tag. * @param {expression} onTagRemoved Expression to evaluate upon removing an existing tag. The removed tag is available as $tag. */ -angular.module('tags-input').directive('tagsInput', function($timeout, $document, configuration) { +tagsInput.directive('tagsInput', function($timeout, $document, configuration) { function SimplePubSub() { var events = {}; diff --git a/src/transclude-append.js b/src/transclude-append.js index e20b5c30..dccb00a0 100644 --- a/src/transclude-append.js +++ b/src/transclude-append.js @@ -1,4 +1,3 @@ -(function() { 'use strict'; /** @@ -8,12 +7,10 @@ * @description * Re-creates the old behavior of ng-transclude. */ -angular.module('tags-input').directive('transcludeAppend', function() { +tagsInput.directive('transcludeAppend', function() { return function(scope, element, attrs, ctrl, transcludeFn) { transcludeFn(function(clone) { element.append(clone); }); }; -}); - -}()); \ No newline at end of file +}); \ No newline at end of file