Srini Srini - 1 month ago 19
AngularJS Question

Sweet alert dialog with spinner in AngularJs

I am trying to display a spinner in a

sweet alert
dialog something close to Bootstrap modal dialog (http://jsfiddle.net/D6rD6/5/)

The closest i could come up with is something like this :

SweetAlert.swal({
title: '<small>Import errors occurred !</small>',
text: '<i class="fa fa-spinner" aria-hidden="true"></i>',
html: true,
customClass: 'manual-upload-errors-swal-width'
});


If this is not possible whats the closest and best solution ?

Answer

The original sweet alert plugin is unsupported, I suggest you using SweetAlert2 plugin.

Migration is simple, here's the migration guide: Migration from SweetAlert to SweetAlert2

In SweetAlert2 there's swal.showLoading(), so you can show loading modal as easy as:

swal('Please wait')
swal.showLoading()
<script src="https://cdn.jsdelivr.net/sweetalert2/5.3.8/sweetalert2.js"></script>
<link href="https://cdn.jsdelivr.net/sweetalert2/5.3.8/sweetalert2.css" rel="stylesheet"/>

Comments