Skip to content

Commit

Permalink
fix(autocomplete): store hasNotFoundTemplate in shared element
Browse files Browse the repository at this point in the history
As before, the `hasNotFoundTemplate` Boolean was stored in the directive function so its used by all `autocomplete` directives, and that's wrong

Fixes angular#5865
  • Loading branch information
devversion committed Nov 21, 2015
1 parent 8051e98 commit 21a756a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/autocomplete/js/autocompleteDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ angular
*/

function MdAutocomplete () {
var hasNotFoundTemplate = false;

return {
controller: 'MdAutocompleteCtrl',
Expand All @@ -145,7 +144,8 @@ function MdAutocomplete () {
inputId: '@?mdInputId'
},
link: function(scope, element, attrs, controller) {
controller.hasNotFound = hasNotFoundTemplate;
controller.hasNotFound = element.hasNotFoundTemplate;
delete element.hasNotFoundTemplate;
},
template: function (element, attr) {
var noItemsTemplate = getNoItemsTemplate(),
Expand All @@ -154,7 +154,7 @@ function MdAutocomplete () {
tabindex = attr.tabindex;

// Set our variable for the link function above which runs later
hasNotFoundTemplate = noItemsTemplate ? true : false;
element.hasNotFoundTemplate = !!noItemsTemplate;

if (attr.hasOwnProperty('tabindex')) {
element.attr('tabindex', '-1');
Expand Down

0 comments on commit 21a756a

Please sign in to comment.