This package has been deprecated

    Author message:

    WARNING: This project has been renamed to NG-Alerts. Install using @jaspero/ng-alerts instead.

    @jaspero/ng2-alerts
    TypeScript icon, indicating that this package has built-in type declarations

    0.0.7 • Public • Published

    Build Status NPM Version

    NG2 Alerts

    An easy to use alert library for Angular 2.

    npm install --save @jaspero/ng2-alerts
    

    A demo can be found here

    Setup

    Import JasperoAlertsModule in your @NgModule:

    @NgModule({
        imports: [
            JasperoAlertsModule
        ],
        declarations: [AppComponent],
        bootstrap: [AppComponent]
    })
    export class AppModule {}

    Then create the component in a root component (you can create it anywhere but you can only use it in that component on any lower ones).

    <jaspero-alerts [defaultSettings]="options"></jaspero-alerts>

    How To Use

    You need to import the AlertsService in your component:

    constructor(private _alertAlertsService) {}

    Then use the create(type: 'success' | 'error' | 'wearning', 'info', message: string, settings: AlertSettings) method to initiate an alert.

    open(typeAlertType) {
        this._alert.create(type, 'This is a message');
    }

    Options

    Available settings:

    export interface AlertSettings {
        overlay?: boolean;
        overlayClickToClose?: boolean;
        showCloseButton?: boolean;
        duration?: number;
    }

    You can provide the settings as input to the <jaspero-alerts></jaspero-alerts> component. Making the settings default for each created alert. However you can also override the settings by passing them in the create() method.

    Install

    npm i @jaspero/ng2-alerts

    DownloadsWeekly Downloads

    14

    Version

    0.0.7

    License

    MIT

    Last publish

    Collaborators

    • flauc1