Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 655eb0f

Browse files
devversionThomasBurleson
authored andcommitted
fix(autocomplete): store hasNotFoundTemplate in shared element
As before, the `hasNotFoundTemplate` Boolean was stored in the directive function so its used by all `autocomplete` directives, and that's wrong Fixes #5865 Closes #5867
1 parent 5871c93 commit 655eb0f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/components/autocomplete/demoInsideDialog/dialog.tmpl.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ <h2>Autocomplete Dialog Example</h2>
3131
</div>
3232
</md-dialog-content>
3333

34-
<div class="md-actions">
34+
<md-dialog-actions>
3535
<md-button aria-label="Finished" ng-click="ctrl.finish($event)">Finished</md-button>
36-
</div>
37-
</md-dialog>
36+
</md-dialog-actions>
37+
</md-dialog>

src/components/autocomplete/js/autocompleteDirective.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ angular
118118
*/
119119

120120
function MdAutocomplete () {
121-
var hasNotFoundTemplate = false;
122121

123122
return {
124123
controller: 'MdAutocompleteCtrl',
@@ -145,7 +144,8 @@ function MdAutocomplete () {
145144
inputId: '@?mdInputId'
146145
},
147146
link: function(scope, element, attrs, controller) {
148-
controller.hasNotFound = hasNotFoundTemplate;
147+
controller.hasNotFound = element.hasNotFoundTemplate;
148+
delete element.hasNotFoundTemplate;
149149
},
150150
template: function (element, attr) {
151151
var noItemsTemplate = getNoItemsTemplate(),
@@ -154,7 +154,7 @@ function MdAutocomplete () {
154154
tabindex = attr.tabindex;
155155

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

159159
if (!attr.hasOwnProperty('tabindex')) element.attr('tabindex', '-1');
160160

0 commit comments

Comments
 (0)