Skip to content

leftstick/angular-sweetalert

Repository files navigation

angular-sweetalert

==================

NPM version

An angular service which expose sweetAlert2 functions in angular way.

What's the difference between 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

Requirements

Install

from npm

npm install --save sweetalert2 angular-h-sweetalert

from bower

bower install --save sweetalert2 angular-h-sweetalert

Import

ES2015

import "sweetalert2/dist/sweetalert2.min.css";
import { ngSweetAlert2 } from "angular-h-sweetalert";

CommonJS

require("sweetalert2/dist/sweetalert2.min.css");
const { ngSweetAlert2 } = require("angular-h-sweetalert");

script

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>DEMO</title>
    <link rel="stylesheet" type="text/css" href="node_modules/sweetalert2/dist/sweetalert2.min.css">
</head>
<body>

    <script type="text/javascript" src="node_modules/angular/angular.min.js"></script>
    <script type="text/javascript" src="node_modules/sweetalert2/dist/sweetalert2.min.js"></script>
    <script type="text/javascript" src="node_modules/angular-h-sweetalert/dist/ngSweetAlert2.min.js"></script>
    <script type="text/javascript">
        var ngSweetAlert2 = window.ngSweetAlert2;
    </script>
</body>
</html>

Basic Usage

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

LICENSE

MIT License

About

An angular service which expose sweetalert2 functions in angular way

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •