更新时间:2023-11-17 16:44:16
如果你可以依赖 sweetalert2 ,对话服务变得非常简单:
If you're ok taking a dependency on sweetalert2, a dialog service becomes pretty simple:
import { Injectable } from '@angular/core';
import { default as swal } from 'sweetalert2';
@Injectable()
export class DialogService {
confirm(title: string, message: string) {
return swal({
title: title,
text: message,
type: 'warning',
showCancelButton: true
});
};
}