0.1.2 • Published 6 years ago

ng2-bootstrap-alert v0.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

ng2-bootstrap-alert

A simple Angular 2 library for displaying alert messages

Usage

  • install library npm i ng2-bootstrap-alert --save
  • Install peer dependencies
    • bootstrap npm i bootstrap --save
    • angular material icons npm i material-design-icons --save
  • update .angular-cli.jsonto include following css files under **styles** section -../node_modules/material-design-icons/iconfont/material-icons.css`
    • ../node_modules/bootstrap/dist/css/bootstrap.min.css
  • update your app.module.ts
    - to import {AlertModule} from 'ng2-bootstrap-alert'; - add AlertModule in imports section
  • update your root (component) html to include <alert></alert>
  • From your components start using alert service to display messages - this.alertService.error("message",ttl,Position); (import alert service and inject it into the component

Available Methods

MethodDescriptionUsage
errordisplays errorsthis.alertService.error("message")
warndispalys warningsthis.alertService.warn("message")
infodispalys infothis.alertService.info("message")
successdispalys success`this.alertService.success("message")

Method Params

ParamOptionsRequired?DefaultDescription
messageStringYesMessage to display
ttlintNo0time in sec to display the message
positionPositionType.TOP_LEFT,PositionType.TOP_RIGHT,PositionType.BOTTOM_LEFT, PositionType.BOTOM_RIGHT,PositionType.DEFAULTNoPositionType.DEFAULTposition of the message