Angular项目中如何使用Swal?

How to use Swal in Angular project?

好吧,我有一个 angular 项目,想在上面使用 swal2,但我不知道如何集成它。

请帮忙。

需要用命令安装,

npm install --save sweetalert

然后在组件中,

import swal from 'sweetalert';

用作,

 swal({
      content: component.location.nativeElement
    }).then(() => {
      component.destroy();
    });

STACKBLITZ DEMO