第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

單擊下拉列表中的數(shù)據(jù)時(shí)如何關(guān)閉 angular2-multiselect-dropdown

單擊下拉列表中的數(shù)據(jù)時(shí)如何關(guān)閉 angular2-multiselect-dropdown

大話西游666 2021-12-02 19:48:58
我是 angular 的新手,我試圖訪問angular2-multiselect-dropdown單個(gè)選擇并顯示所選數(shù)據(jù)。在這里,我希望下拉菜單在單擊選擇數(shù)據(jù)時(shí)關(guān)閉/隱藏。請(qǐng)檢查https://stackblitz.com/edit/r7-angular2-multislect
查看完整描述

2 回答

?
白衣染霜花

TA貢獻(xiàn)1796條經(jīng)驗(yàn) 獲得超10個(gè)贊

這個(gè)想法是AngularMultiSelect在你的組件中創(chuàng)建類的實(shí)例,Viewchild然后調(diào)用它的closeDropdown()方法。


腳步:


#dropdownRef在模板中添加


<angular2-multiselect [data]="dropdownList" [(ngModel)]="selectedItems" [settings]="dropdownSettings" (onSelect)="onItemSelect($event)" #dropdownRef> </angular2-multiselect>

在 TS 文件中執(zhí)行以下操作:


import { AngularMultiSelect } from 'angular2-multiselect-dropdown';


@ViewChild('dropdownRef',{static:false}) dropdownRef: AngularMultiSelect;


onItemSelect(item: any) {

   console.log(item);

   this.dropdownRef.closeDropdown()

}


查看完整回答
反對(duì) 回復(fù) 2021-12-02
?
蕪湖不蕪

TA貢獻(xiàn)1796條經(jīng)驗(yàn) 獲得超7個(gè)贊

使用@ViewChild訪問到這樣的下拉列表:

@ViewChild(AngularMultiSelect, {static: false}) dDown: AngularMultiSelect;

現(xiàn)在您可以隨時(shí)關(guān)閉下拉菜單:

this.dDown.closeDropdown()


查看完整回答
反對(duì) 回復(fù) 2021-12-02
  • 2 回答
  • 0 關(guān)注
  • 325 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)