【发布时间】:2021-07-19 16:56:11
【问题描述】:
我正在编写一个代码,用户可以在其中更改屏幕上的段落并将其保存。目前,用户可以更改段落,save() 操作有效。但是保存后,更改的段落不会通过网络。该段落不会更改,它会保存未经编辑的版本,就好像我什么都没写一样。我应该改变什么来实现这一点?
HTML:
<div class="content fuse-white ml-24 mr-8 h-100-p" fusePerfectScrollbar>
<div class="label-list">
<p>
A Paragraph:
<span contenteditable="true">
{{_stickerData?.StickerData}}
</span>
</p>
</div>
</div>
TS:
save(){
this.confirmDialogRef = this._dialog.open(FuseConfirmDialogComponent, {
disableClose: false,
});
this.confirmDialogRef.componentInstance.confirmMessage =
"The paragraph will be changed";
this.confirmDialogRef.afterClosed().subscribe((result) => {
if (result) {
this._productionService
.saveStickerData(this._stickerData)
.subscribe((response: IStickerData) => {
this._stickerData = response;
this._messages.Show(
"SUCCESS",
3
);
});
}
});
}
服务 TS:
saveStickerData(data: IStickerData): Observable<IStickerData> {
return this._http.post("Production/SaveStickerData", data);
}
【问题讨论】:
标签: javascript html angular typescript