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', "