且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Angular2中创建Dialog服务

更新时间: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
        });
    };
}