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

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

如何從下拉列表選項(xiàng)中單擊彈出模式

如何從下拉列表選項(xiàng)中單擊彈出模式

蕪湖不蕪 2022-09-02 21:00:22
好日子開發(fā)人員,我在這個(gè)應(yīng)用程序中工作與角度,現(xiàn)在我試圖一旦其中一個(gè)選項(xiàng)被點(diǎn)擊,以顯示一個(gè)模態(tài)標(biāo)簽。基本上,我所做的是創(chuàng)建一個(gè)與下拉列表中選擇的項(xiàng)目相等的paralell模板,并且在此模板上使用a標(biāo)簽設(shè)置所有邏輯以顯示模式,但猜測(cè)不是用戶友好的幾個(gè)額外點(diǎn)擊的原因。嘗試在選項(xiàng)中設(shè)置標(biāo)記也是不可行的,因?yàn)槲业南吕斜聿黄鹱饔?。這里有一個(gè)關(guān)于我所做的事情的嘲笑:HTML tag      <select [hidden]="!state" name="optionsInc" required [(ngModel)]="optionsInc" (change)="subItemSelected($event)">        <option value="select" [ngValue]="null" [disabled]="true">Select Income</option>        <option *ngFor="let item of allKeysIncomings" label="{{item}}" value="{{item}}"></option>      </select>====>DROPDOWN LIST LOGIC    <p [hidden]="!state"> <a *ngIf="incomeSelected"      href="#"      class="btn btn-primary btn-block"      data-toggle="modal"      data-target="#editItem"    >{{incomeSelected}}</a>    </p>====>PARALELL REFERENCE TO POP THE MODAL UP    <div class="modal fade" id='editItem'>======>MODAL       SOME TAGS AND CODE    </div>然后在我的組件上,我這樣做了:imports...@Component({  selector: 'app-user-sheet-balance',  templateUrl: './user-sheet-balance.component.html',  styleUrls: ['./user-sheet-balance.component.css'],})export class UserSheetBalanceComponent implements OnInit {allKeysIncomings: any;==>ITERABLEincomeSelected: string;constructor(some code) {}ngOnInit(): void {some code}  async subItemSelected(event) {    SOME CODE      return (        await (this.incomeSelected = event.target.value),     );  }所有這些過程都會(huì)在單擊標(biāo)記a后激活模式時(shí)執(zhí)行任務(wù),但是不是創(chuàng)建對(duì)下拉列表的paralell引用,而是想知道是否有可能直接從下拉列表中執(zhí)行此操作。我一直在社區(qū)上看到一些類似的問題,例如:使用下拉列表中的選項(xiàng)打開模態(tài) - Angular 2 + ngx,但不適用于我的代碼規(guī)范。關(guān)于這個(gè)的任何更新的想法?提前致謝!!!!!!
查看完整描述

1 回答

?
Qyouu

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

如果你有對(duì)話框布局,它應(yīng)該工作如下ComponentModalComponent


    import { Injectable } from '@angular/core';

    import { MatDialog, MatDialogRef } from '@angular/material/dialog';

    import { ModalComponent } from './modal/modal.component';


    @Injectable({

      providedIn: 'root'

    })

    export class TestDialogService {


      dialogRef: MatDialogRef<ModalComponent, any>;


      constructor(public dialog: MatDialog) { }


      open() {

        if(this.dialogRef) {

          this.dialogRef.close();

        }

        this.dialogRef = this.dialog.open(ModalComponent, {

          panelClass: 'app-dialog'

        });

      }


      close() {

        if(this.dialogRef) {

          this.dialogRef.close();

        }

      }

    }


    // html

    <mat-form-field>

      <mat-label>Favorite car</mat-label>

      <select name="optionsInc"

        matNativeControl 

        [(ngModel)]="optionsInc" 

        (ngModelChange)="onModelChange()">


        <option value="select" [value]="null" [disabled]="true">Select Income</option>

        <option *ngFor="let item of allKeysIncomings" [label]="item.viewValue" 

          [value]="item.value"></option>

      </select>

    </mat-form-field>


    // ts

    @Component({

      selector: 'app-root',

      templateUrl: "./app.component.html",

      styleUrls: ["./app.component.scss"]

    })

    export class AppComponent {

      state = false;

      optionsInc = null;

      allKeysIncomings = [

        {value: 'volvo', viewValue: 'Volvo'},

        {value: 'saab', viewValue: 'Saab'},

        {value: 'mercedes', viewValue: 'Mercedes'}

      ];


      constructor(

        public testDialogService: TestDialogService) {

      }


      onModelChange() {

        this.testDialogService.open();

      }

    }


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

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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