From adaf6580320a47b962cb769407ae19abd8e6317c Mon Sep 17 00:00:00 2001 From: Michael Benford Date: Sat, 28 Dec 2013 19:30:23 -0200 Subject: [PATCH] feat(autocomplete): Add support for $http promises Add support for $http promises so they can be returned as is by the source option expression without requiring its value to be converted. Closes #38. --- README.md | 4 +--- build/ng-tags-input.js | 12 +++++------- build/ng-tags-input.min.zip | Bin 4400 -> 4397 bytes build/ng-tags-input.zip | Bin 7548 -> 7548 bytes src/auto-complete.js | 5 +---- test/auto-complete.spec.js | 11 +++++++++++ 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 45a6517c..5137d69f 100644 --- a/README.md +++ b/README.md @@ -39,9 +39,7 @@ You can also use Bower to install all files at once. Just run `bower install ng- .controller('MyCtrl', function($scope, $http) { $scope.tags = ['just','some','cool','tags']; $scope.loadTags = function(query) { - return $http.get('/tags?query=' + query).then(function(response) { - return response.data; - }); + return $http.get('/tags?query=' + query); }; }); diff --git a/build/ng-tags-input.js b/build/ng-tags-input.js index baff0cc0..2857fe93 100644 --- a/build/ng-tags-input.js +++ b/build/ng-tags-input.js @@ -53,7 +53,7 @@ tagsInput.directive('tagsInput', ["$timeout","$document","tiConfiguration", func }, trigger: function(name, args) { angular.forEach(events[name], function(handler) { - handler.call(null, args); + handler.call(null, args); }); } }; @@ -298,9 +298,6 @@ tagsInput.directive('autoComplete', ["$document","$timeout","$sce","tiConfigurat self.selected = null; self.visible = true; }; - self.hide = function() { - self.visible = false; - }; self.load = function(query, tags) { if (query.length < options.minLength) { self.reset(); @@ -319,7 +316,7 @@ tagsInput.directive('autoComplete', ["$document","$timeout","$sce","tiConfigurat return; } - self.items = getDifference(items, tags); + self.items = getDifference(items.data || items, tags); if (self.items.length > 0) { self.show(); } @@ -564,9 +561,10 @@ tagsInput.service('tiConfiguration', ["$interpolate", function($interpolate) { }; }]); + +/* HTML templates */ tagsInput.run(["$templateCache", function($templateCache) { - - $templateCache.put('ngTagsInput/tags-input.html', + $templateCache.put('ngTagsInput/tags-input.html', "
  • {{tag}}
" ); diff --git a/build/ng-tags-input.min.zip b/build/ng-tags-input.min.zip index 9f9f0995c558012f1f57b469713bd2dd0aa83d03..c0adab2a6a5cb39174f579eccea94bff298c41b6 100644 GIT binary patch delta 2712 zcmV;J3TO4OBCR3~P)h>@6aWYa2mr{NoUsi;27i{AzN25U#H7_#8w(df2XW?3s|cd& zAx|P};?A6&1T6ByzPHAnl5{1TOtgm1_EfISR*ieUM8*!hY9+Gn46I2-64eloQkJ3O zAMuLsb{yi7VaQ;n@XeLdjyp55!RTm2y+{N(dS3BPr2L7TQ_Cz3B`fXE;_Kj2w7HyD zuYcMLP*#=1pNb?eI%Bz8Lp>fJQg?*VX>!Tu+#iZQp3eB?-Wow8ANZ zp8rPm@dLG&rl~FSx(@^7 zhp3opCV?;Y2LA}2EY6X>sYMNOd^@=OXZp7311FMpKm zRCfmuW5-Dc{0Lji-W}GoU%osYy?hCm=wMCH(He+R)|i=;)DV3H*!1tQgff3)R=Z$O z*UFLNbWXiD9uDtM+foi#=5!lS-S~T|;G1+k*aVyqFPwxhYIjfTiRrJQ`MpX=bc})p zADyCSUtWHB>3FZ^E`6auxDe~h(|_s389vbY5G26d-viEuMOUWI0rbXGRPoGI8H3eY^hTH;qcsd>HpkFlXA{{T zpfQr9J-kSO_&Zp#&!o*W%LYbmYYM>&;KmL^62g!mkm7T0E|jt^t`2n$^?ySV)SGTw z=Gnb{74Af%^PW152U0&QLFR6!ejq^*ToZ_hffK^?Okm>>7q-SYW;e(Y8rbJGa~b;nL*(#q9}rc^t(p5>0oP~fJ&mK7tZ!E2=#I(eLkz2{2Y8Ir zUXf$bb zUR(gyXI4maL|+bjq*?9Di!<7|d_iC`EKA3Z5;W)h2~aP~Gl4QDSEbt}X;RU~D#4&A z(_4>8RIRW|<%Xsf1`ccWg^MYHQ4x89kTpgD=NellrJ5tcP^wGdrhhp=jYda=xv69K z=9{*=+tGwXVAKQuMs_(69{Ck*#Wqmlw=xQ}Df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icpH^$yaI+j z4Jhhqj!5)7;cG);yiceqaN4Ql?L9DY(r%G`e~i#)Y$W%e!Xk_42y1TK0R~E7bBsq` z4zbBG_MgGOTOyF$_4!GjGCD-}B#O>h7NqQiEWCvP~4x{XNg%dxU)P_pue&-Osf;=ld(rk^lHj9 zTOSy0)0B}|$nJ?L-s!}9xPP)kAKiWOhd8v&Bd-Wom+HI>Dn6Zs3tV zi>YwmGD_g00Jxq`ipxuA=3l9c!2K&Ve_4MDEzrjvPxgpjH;SWi*8c}F*Amy?W+2iq z2D8QB_QY-`g4#8E03oaJ;%oiF@baQx;k-->e==nGt7I+ zPC)MRSYcUd=`Wd!MgroWjg=L4o?*f{8{K^&nKrj}bc`b!3CF(Ee`3S22V8Z3S7!!8 zfj{GmR?a&Hy|rJB2CJz~QVpKpH9%1+?%dtMn|#Wb zL7B?oF+IfE;R!6_u5I6Ro z;5PzX9T&X6Z+1BI-d@8AsTTq7X=jYd?-4!tt8lAra5s{JPvQflICPW#EhlXkL_eu&f3}GO{vvS~_2a8k z5R8nb7hqV4+oa$=7;OH(4`I~N*EW$Pj9>}8EtMQ*3*{O!wyR;`&Kc9h^&QD+289I3 zyBm-rUZNm1qgeFT-9PF#^trCm`m{K(Oz$?g8Zx4psRFh)wg7fusxaNkoGWkL+KF1s zTE#h`zc36B7E0=-K~D(1P$QSrT&nUOUz&yCuH2;SFv344l)_2FLw%~gWtHQ908mQ@ z2m+l>q 0) { self.show(); } diff --git a/test/auto-complete.spec.js b/test/auto-complete.spec.js index ccecfba9..a6b2480e 100644 --- a/test/auto-complete.spec.js +++ b/test/auto-complete.spec.js @@ -111,6 +111,17 @@ describe('autocomplete-directive', function() { expect(getSuggestionText(1)).toBe('Item2'); }); + it('renders all elements returned by the load function that aren\'t already added ($http promise)', function() { + // Act + tagsInput.getTags.andReturn(['Item3']); + loadSuggestions({ data: ['Item1','Item2','Item3'] }); + + // Assert + expect(getSuggestions().length).toBe(2); + expect(getSuggestionText(0)).toBe('Item1'); + expect(getSuggestionText(1)).toBe('Item2'); + }); + it('shows the suggestions list when there are items to show', function() { // Act loadSuggestions(['Item1']);