==================
An angular service which expose sweetAlert2 functions in angular way.
2.x
and 1.x
?Since sweetAlert is unmaintained. I choose sweetAlert2 as new interface. See below:
Reason of creating this fork is inactivity of original SweetAlert plugin
npm install --save sweetalert2 angular-h-sweetalert
bower install --save sweetalert2 angular-h-sweetalert
import "sweetalert2/dist/sweetalert2.min.css";
import { ngSweetAlert2 } from "angular-h-sweetalert";
require("sweetalert2/dist/sweetalert2.min.css");
const { ngSweetAlert2 } = require("angular-h-sweetalert");
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>DEMO</title>
<link rel="stylesheet" type="text/css" href="https://github.com/leftstick/angular-sweetalert/blob/master/node_modules/sweetalert2/dist/sweetalert2.min.css">
</head>
<body>
<script type="text/javascript" src="https://github.com/leftstick/angular-sweetalert/raw/master/node_modules/angular/angular.min.js"></script>
<script type="text/javascript" src="https://github.com/leftstick/angular-sweetalert/raw/master/node_modules/sweetalert2/dist/sweetalert2.min.js"></script>
<script type="text/javascript" src="https://github.com/leftstick/angular-sweetalert/raw/master/node_modules/angular-h-sweetalert/dist/ngSweetAlert2.min.js"></script>
<script type="text/javascript">
var ngSweetAlert2 = window.ngSweetAlert2;
</script>
</body>
</html>
const demo = angular.module("demo", [ngSweetAlert2]);
demo.controller("demoController", [
"$scope",
"swal",
function($scope, swal) {
$scope.basic = function() {
swal("The Internet?", "That thing is still around?", "question");
};
}
]);
Looking for more usage examples?, check: examples