本文整理匯總了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.
});
}