簡體   English   中英

如何在Angular2的ionic 2中使用SweetAlert?

[英]How to use SweetAlert in ionic 2 with Angular2?

swal(“干得好!”,“您單擊了按鈕!”,“成功”)

我想使用Angular 2在我的離子應用程序中使用這種類型的swal警報有人可以指導嗎?

有一個甜蜜的警報模塊可用於角度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時,這將起作用。

編輯2017年9月

自2017年8月起已棄用

您應該使用https://github.com/toverux/ngsweetalert2https://www.npmjs.com/package/sweetalert2

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM