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

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

如何在Angular中實(shí)現(xiàn)數(shù)據(jù)刪除功能

如何在Angular中實(shí)現(xiàn)數(shù)據(jù)刪除功能

慕勒3428872 2023-10-24 21:31:22
在我們網(wǎng)站的編輯頁(yè)面中,我有一個(gè)墊卡/工作區(qū)列表,并且每個(gè)工作區(qū)的右上角都有編輯圖標(biāo)。通過(guò)單擊該編輯圖標(biāo),您將進(jìn)入該工作區(qū)的編輯頁(yè)面,其中有一個(gè)刪除按鈕,單擊該按鈕時(shí)會(huì)顯示一個(gè)對(duì)話框,并允許用戶決定是否確實(shí)要?jiǎng)h除該工作區(qū)。不太確定如何進(jìn)行 API 調(diào)用 .name.length > 0 && this.description.length > 0) {      //map      this.workspace.name = this.name;      this.workspace.description = this.description;      this.workspace.type = WorkspaceType.public; //all workspaces that are created are public by default      //create      this.workspaceService.createWorkspace(this.workspace).subscribe(workspace => {        this.saving = false;        this.gotoManage();        this.snackbar.open(this.workspace.name+ " has been created!!", "", {duration :2500});      }, () => this.saving = false);    }  }
查看完整描述

1 回答

?
MM們

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

你可以這樣做:


openModalConfirmationDialog(content1: TemplateRef<any>, row, content2:TemplateRef<any>, content3: TemplateRef<any>) {

// you can store row or data selected until page is active

  this.contetntIWantToDelete = row;

// Make availale data in popup for confirmation

    this.modalService.open(content1).then(result => {

        if (result) {

        // load the data (row) which is to be deleted

            this.modalService.open(content2);

        // update delete

     this.yourDeleteinfoAPIcustomFunction('/name1/requestedWorkspaceDelete', row.id, content3);

        }

    });

}


yourDeleteinfoAPIcustomFunction(url, param, content1: TemplateRef<any>) { 

// This function have success and error messages based on what is selected for deletion

 this.http.get(baseUrl + url, options)

        .subscribe(r => {

                if (r != null) {

                   // success delete operation

                } else {

                    // failed delete op.

                }

            }

}


在您的 html 刪除按鈕中:


(click)="openModalConfirmationDialog(modalConfirm, row, modalDeleteProgress, modalDeleteSuccess)"

在上面的函數(shù)中:我有一組在函數(shù)中傳遞的對(duì)話框,正如您提到的您想從對(duì)話框中獲得確認(rèn):


<ng-template #modalConfirm>

    <custom-directive>

        <p>Confirm delete operation</p>

        <p>Delete workspace Id: <B>{{workspace.id}}

            <br></B><B>{{moreDetails}}</B>

    </custom-directive>

</ng-template>


<ng-template #modalDeleteProgress>

    <custom-directive type="warning" warningTitle="Delete in progress">

    </custom-directive>

</ng-template>


 <ng-template #modalDeleteSuccess>

    <custom-directive type="success" successTitle="Success" btn="Close">

        <div>workspace ID: {{workspace.id}} has been deleted</div>

    </custom-directive>

</ng-template>


查看完整回答
反對(duì) 回復(fù) 2023-10-24
  • 1 回答
  • 0 關(guān)注
  • 151 瀏覽

添加回答

舉報(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)