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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

獲取 ionic4 中 ion-select-option 的名稱

獲取 ionic4 中 ion-select-option 的名稱

達令說 2021-10-14 10:17:52
我無法從離子選擇中獲取名稱。我可以使用[(ngmodel)]. 但是,我可以找到如何從選定的離子選擇選項中獲取名稱。<ion-item>      <ion-select placeholder="Select User"  [(ngModel)]="selectedUser" (ionChange)="selectedUser1(selectedUser)" style="width:100%;max-width:100%;">                        <ion-select-option *ngFor="let item of user" value="{{item.pos_id}}">{{item.pos_name}}</ion-select-option>        </ion-select>    </ion-item>我需要{{item.pos_name}}在打字稿變量中獲取- 名稱。請幫我獲取所選離子選擇選項的名稱
查看完整描述

1 回答

?
斯蒂芬大帝

TA貢獻1827條經驗 獲得超8個贊

1 個選項:您可以遍歷User數組以查找名稱和其他信息。


selectedUser1(selectedUser){

 this.user.map(val, index){

   if(selectedUser == val.pos_id){

     console.log(val); // this will print your complete object of user.

  }

 }

}

2 選項:使用您的 ID 將名稱作為值傳遞。


<ion-select-option *ngFor="let item of user" value="{{item.pos_id}}, {{item.pos_name}}">{{item.pos_name}}</ion-select-option>

您將在selectedUserngModel 中獲得 id 和 Name 。您可以根據需要拆分它。


查看完整回答
反對 回復 2021-10-14
  • 1 回答
  • 0 關注
  • 264 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號