0.0.8 • Published 8 years ago

ng2-sweetalert2 v0.0.8

Weekly downloads
226
License
MIT
Repository
github
Last release
8 years ago

ng2-sweetalert2

A service wrapping sweetalert2 for angular 2.

Install

npm i -s ng2-sweetalert2

Usage

First, make sure you have a CSS loader set up for webpack, like so:

{
  test: /\.css/,
  loader: 'style!css'
},

Next, inject SweetAlertService into a component:

import { SweetAlertService } from 'ng2-sweetalert2';

@Component({
  providers: [SweetAlertService]
})
export class MyComponent {

  static get parameters() {
    return [[SweetAlertService]];
  }

  constructor(swal) {
    this.swalService = swal;
  }

API

See limonte/sweetalert2 for examples.

FunctionArgumentsDescription
swalanyCreate a generic swal with any arguments.
promptobjectCreate a swal that prompts user with a basic text entry field.
confirmobjectCreate a swal that confirms a user action.
alertobjectCreate a swal that alerts a user of something that happened.
questionobjectWrapper for alert that sets type to question.
successobjectWrapper for alert that sets type to success.
errorobjectWrapper for alert that sets type to error.
warnobjectWrapper for alert that sets type to warn.
infoobjectWrapper for alert that sets type to info.