简体   繁体   English

角度材质选项卡和自动完成

[英]Angular Material Tabs and autocomplete

I use md-tab for my html page and in each tab i use an autocomplete component as follows: 我为我的html页面使用md-tab,在每个选项卡中,我使用一个自动完成组件,如下所示:

<md-autocomplete                        
            md-selected-item="selectedItem"
            md-search-text-change="searchTextChange(searchText)"
            md-search-text="searchText"
            md-selected-item-change="selectedItemChange(item)"
            md-items="item in querySearch(searchText) | orderBy:'text'"
            md-item-text="item.text"
            md-min-length="0"
            placeholder="Easy filter"
            md-menu-class="autocomplete-custom-template">
            <md-item-template style="background-color:white;">
                <span class="select-title">
                    <span class="item-tags"> {{item.text}} </span>
                </span>
            </md-item-template>
        </md-autocomplete>

I use that same code in my all tabs. 我在所有标签中都使用了相同的代码。 And the problem is: when i click on autocomplete component, i get two lists: one is under my autocomplete box (which is normal) and one is at the left hand side, which is the list of the another autocomplete box in that other tab. 问题是:当我单击自动完成组件时,我得到两个列表:一个在我的自动完成框下(正常),一个在左侧,这是另一个选项卡中另一个自动完成框的列表。

Why is that showing? 为什么显示? Is there a work-around? 有解决方法吗?

I tried to reproduce with Angular 1.3.0 and Angular-Material 0.11.4 and works fine. 我尝试使用Angular 1.3.0和Angular-Material 0.11.4进行复制,并且效果很好。

You can try put a md-input-id="theInputId" in each md-autocomplete. 您可以尝试将md-input-id =“ theInputId”放在每个md-autocomplete中。 As last resort, link each autocomplete with each tab using the autocomplete id and tab $index, disabling autocompletes of inactive tabs. 不得已时,请使用自动完成ID和标签$ index将每个自动完成与每个标签链接,以禁用非活动标签的自动完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM