SwaI位( “干得好!', '您点击了按钮!', '成功' )
我想在我的离子应用程序中使用这种类型的swal警报使用角度2可以任何人指导吗?
答案 0 :(得分:2)
有一个可用于角度2的甜蜜警报模块
https://github.com/seiyria/ng2-sweetalert2
import { SweetAlertService } from 'ng2-sweetalert2';
@Component({
providers: [SweetAlertService]
})
export class MyComponent {
static get parameters() {
return [[SweetAlertService]];
}
constructor(swal) {
this.swalService = swal;
}
当sweetalert2.min.css加载时,这将有效。
编辑9月:2017
截至2017年8月已弃用
您应该使用https://github.com/toverux/ngsweetalert2或https://www.npmjs.com/package/sweetalert2