本文整理汇总了TypeScript中@providers/utils/dom.CoreDomUtilsProvider.showConfirm方法的典型用法代码示例。如果您正苦于以下问题:TypeScript CoreDomUtilsProvider.showConfirm方法的具体用法?TypeScript CoreDomUtilsProvider.showConfirm怎么用?TypeScript CoreDomUtilsProvider.showConfirm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@providers/utils/dom.CoreDomUtilsProvider
的用法示例。
在下文中一共展示了CoreDomUtilsProvider.showConfirm方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
this.element.addEventListener('click', (ev: Event): void => {
ev.preventDefault();
ev.stopPropagation();
if (typeof this.confirmMessage != 'undefined') {
// Ask for confirm.
this.domUtils.showConfirm(this.confirmMessage || this.translate.instant('core.areyousure')).then(() => {
this.callWS();
}).catch(() => {
// User cancelled, ignore.
});
} else {
this.callWS();
}
});
示例2: delete
/**
* Delete a file from the list.
*
* @param {number} index The index of the file.
* @param {boolean} [askConfirm] Whether to ask confirm.
*/
delete(index: number, askConfirm?: boolean): void {
let promise;
if (askConfirm) {
promise = this.domUtils.showConfirm(this.translate.instant('core.confirmdeletefile'));
} else {
promise = Promise.resolve();
}
promise.then(() => {
// Remove the file from the list.
this.files.splice(index, 1);
}).catch(() => {
// User cancelled.
});
}