AngularJS wrapper for SweetAlert2
yarn add ngswal2
import ngswal2 from 'ngswal2'
// inject it as a dependency in your app
angular.module(..., [ngswal2])
// inject the factory
.factory(..., ['Swal', function (Swal, ...) {
// use the factory as you would use the regular SweetAlert2
Swal({
title: 'My title',
text: 'Hello World!'
})
.then(...)
.catch(...)
}])
Using SCSS
@import "~sweetalert2/dist/sweetalert2.css";
You can also reference SweetAlert2's cdn in your HTML.
All methods that return a value (getters ie isVisible
), and methods that return a promise (ie queue
) are not supported.