Skip to content
This repository has been archived by the owner on Nov 8, 2017. It is now read-only.

seiyria/ng2-sweetalert2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED

This library should not be used. Either import swal directly or use this fork instead.

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.

Function Arguments Description
swal any Create a generic swal with any arguments.
prompt object Create a swal that prompts user with a basic text entry field.
confirm object Create a swal that confirms a user action.
alert object Create a swal that alerts a user of something that happened.
question object Wrapper for alert that sets type to question.
success object Wrapper for alert that sets type to success.
error object Wrapper for alert that sets type to error.
warn object Wrapper for alert that sets type to warn.
info object Wrapper for alert that sets type to info.

About

A sweetalert2 service for angular2.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •