Giter Site home page Giter Site logo

ngx-bootstrap-growl's Introduction

ng-bootstrap-growl - Angular >= 2 service to show Bootstrap 4 growl (alert)

Features

  • add custom growl alerts somewhere in your application
  • specify a maximum of alerts to show
  • specify a timeout for the alerts
  • display HTML in your alert
  • specify whether an alert should be dismissable or not
  • use all Bootstrap alert types

Demo

TBD

Dependencies

Installation

You need to install and configure the dependencies above, afterwards:

npm install --save ngx-bootstrap-growl

After installation, add the service and the component to your module:

import {BootstrapGrowlComponent, BootstrapGrowlService} from "ngx-bootstrap-growl";
@NgModule({
    imports: [
        // ...
        BootstrapGrowlModule
    ],
    // ...
})

Integration

Add the component somewhere in your root template:

<bootstrap-growl [alertCount]="3" [autoClose]="10000"></bootstrap-growl>

Parameters (optional)

  • alertCount: maximum number of alerts to show (defaults: 999)
  • autoClose: time in milliseconds (defaults: -1 - never closed)

Style

You can configure the display area of the alerts however you want. Just use the following selector:

bootstrap-growl{
  position:absolute;
  right:8px;
  top:8px;
  z-index:10;
}

Usage

export class AnyComponent{
  constructor(private bootstrapGrowlService: BootstrapGrowlService) {
  }

  addGrowlAlert(){
    //general usage
    this.bootstrapGrowlService.addAlert([message: string], [type: BootstrapAlertType], [dismissable?: boolean]);
    //examples
    this.bootstrapGrowlService.addAlert("any custom message", BootstrapAlertType.SUCCESS);
    this.bootstrapGrowlService.addAlert("any custom message <b>with</b> HTML", BootstrapAlertType.INFO);
    this.bootstrapGrowlService.addAlert("any custom message", BootstrapAlertType.WARNING);
    this.bootstrapGrowlService.addAlert("any custom message", BootstrapAlertType.DANGER, false);
  }
}

ngx-bootstrap-growl's People

Contributors

mbenzenhoefer avatar theomathieubhvr avatar

Watchers

James Cloos avatar Shivam Maheshwari avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.