From 2126073b002b4f704ffc897c6411db634cfce5f0 Mon Sep 17 00:00:00 2001 From: Gabriel Cziprusz Date: Fri, 13 Jan 2017 11:22:47 -0600 Subject: [PATCH 1/2] make matches available to the typeahead-on-select callback --- src/typeahead/typeahead.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/typeahead/typeahead.js b/src/typeahead/typeahead.js index 81492f03dc..baa3ac7f8a 100644 --- a/src/typeahead/typeahead.js +++ b/src/typeahead/typeahead.js @@ -361,7 +361,8 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.debounce', 'ui.bootstrap $item: item, $model: model, $label: parserResult.viewMapper(originalScope, locals), - $event: evt + $event: evt, + $matches: scope.matches }); resetMatches(); From f7278559b186c6f67cb30e7e6cea007a56a93a09 Mon Sep 17 00:00:00 2001 From: Gabriel Cziprusz Date: Tue, 14 Feb 2017 11:11:34 -0600 Subject: [PATCH 2/2] add documentation for on-select $matches --- src/typeahead/docs/readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/typeahead/docs/readme.md b/src/typeahead/docs/readme.md index efd2dfd0fc..933cd99776 100644 --- a/src/typeahead/docs/readme.md +++ b/src/typeahead/docs/readme.md @@ -82,10 +82,10 @@ This directive works with promises, meaning you can retrieve matches using the ` _(Default: `null`)_ - A callback executed when a `keyup` event that might trigger a selection occurs. Selection will only occur if this function returns true. -* `typeahead-on-select($item, $model, $label, $event)` +* `typeahead-on-select($item, $model, $label, $event, $matches)` $ _(Default: `null`)_ - - A callback executed when a match is selected. $event can be undefined if selection not triggered from a user event. + A callback executed when a match is selected. $event can be undefined if selection not triggered from a user event. $matches is an array of match objects. * `typeahead-popup-template-url` _(Default: `uib/template/typeahead/typeahead-popup.html`)_ -