angular-h-sweetalert

2.0.1 • Public • Published

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

GPL v3 License

Readme

Keywords

Package Sidebar

Install

npm i angular-h-sweetalert

Weekly Downloads

134

Version

2.0.1

License

GPL-3.0

Last publish

Collaborators

  • howard.zuo