簡體   English   中英

如何在 Mat-Dialog Angular 中傳遞數組

[英]How to pass an array in Mat-Dialog Angular

如何在墊子對話框中傳遞數組? 我有 2 個組件,一個是對話框,另一個是我的主要組件,所以一旦我輸入一個數量並打開對話框,該行將由 2 填充,所以當我嘗試輸入並單擊按鈕時,它將顯示它到我的主要組件如何實現這一目標?

這就是我所做的

https://stackblitz.com/edit/mat-dialog-example-w3ojzi

        You have to pass data from your alert-dialog.component.ts sameInmemory method like: 
        
             saveInmemory() {
                this.http.post('api/users', this.fg.value).subscribe((res) => {
                  this.dialogRef.close(res);
                });
              }

    This data will be received in you result inside your openAlertDialog 
    method,from here you can patch value in your Form Controls 

希望對您有所幫助,謝謝!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM