1.7.9 • Published 5 years ago

ng7-snack-bar v1.7.9

Weekly downloads
12
License
MIT
Repository
github
Last release
5 years ago

Snackbar For ANGULAR 4/5/6/7

SnackBar is a service for displaying snack-bar notifications. On latest version of angular 4/5/6/7.

  • Group snackbar based on Type, Content.
  • Rank snackbar.

Versions

ng7-snack-barAngular
1.6.04.x
1.7.05.x
1.7.06.x
1.7.07.x

Get Started

  • Please create issues or add suggestions, I am actively working on this module.
  • Setup Code https://stackblitz.com/edit/ng7-snack-bar

  • Demo https://ng7-snack-bar.stackblitz.io

  • Install
    npm install ng7-snack-bar --save
    npm install @ngrx/store --save
    npm install @angular/animations --save (Only for angular >=5.X )
  • Import the SnackBarModule
    import { SnackBarModule } from 'ng7-snack-bar';
    import { StoreModule } from '@ngrx/store';
    
    @NgModule({
      declarations: [AppComponent, ...],
      imports: [SnackBarModule.forRoot(), StoreModule.forRoot([]), ...],
      bootstrap: [AppComponent]
    })
    export class AppModule {
    }
  • Add the SnackBarContainer to AppComponent
     <sb-container></sb-container>
  • Import the SnackBarService to Needed Component
    import { SnackBarService } from 'ng7-snack-bar';
    
    constructor(
       private snackBarService: SnackBarService
    ) {}
    
    showNotification(): void {
     // Info
     this.snackBarService.info('title', 'content', 'detail',);
     // Success
     this.snackBarService.success('title', 'content', 'detail');
     // Warn
     this.snackBarService.warn('title', 'content', 'detail');
     // Error
     this.snackBarService.error('title', 'content', 'detail');
    }

Features

OPTIONTYPEDEFAULTDESCRIPTION
positionPositionTypeBOTTOM_RIGHT4 Positions, to show the snack-bar
maxNoOfSnackBarnumber10Displays max no of snackbar
autoCloseOnTransitionbooleanfalseAuto closes when page route occurs
templateTemplateTypeCLASSICClassic/Dark templates
groupRuleTypeGroupRuleTypeNO_RULEGroups the snack-bar based on type/content
rankBarsArray[]Based on rank the snackbar displays
infoOptionsIBarOptionsConfigure Info snackbar
successOptionsIBarOptionsConfigure Success snackbar
warnOptionsIBarOptionsConfigure Warn snackbar
errorOptionsIBarOptionsConfigure Error snackbar

Additional Snackbar Configuration

OPTIONTYPEDEFAULTDESCRIPTION
isClosebooleanfalseShows/Hides the close button
closeTimeOutnumber0Autoclose after specified interval
isDetailbooleanfalseShows/Hides the detail button
panelClassstringOverrides the specific snackbar class
opacitynumber1Specifies the opacity of snackbar

Service Details

SERVICEARGUMENTSTYPEDESCRIPTION
info, warn, success, errortitlestringSnack bar title, default 'Info'
contentstringSnack bar content
detailstringSnack bar detail
actionsISnackBarAction[]max-3 label, isAutoClose, callBack: () => {}
optionsISnackBarConfigisBackDrop

Live

UpComing Feature 2.0.0

Will add shortly, stay tuned
1.7.9

5 years ago

1.7.8

5 years ago

1.7.7

5 years ago

1.7.6

5 years ago

1.7.5

5 years ago

1.7.4

5 years ago

1.7.3

5 years ago

1.7.2

5 years ago

1.6.1

5 years ago

1.7.1

5 years ago

1.6.0

5 years ago

1.7.0

5 years ago

1.5.9

5 years ago

1.5.8

5 years ago

1.5.7

5 years ago

1.5.6

5 years ago

1.5.5

5 years ago

1.5.4

5 years ago

1.5.3

5 years ago

1.5.2

5 years ago

1.5.1

5 years ago

1.5.0

5 years ago

1.4.9

5 years ago

1.4.8

5 years ago

1.4.7

5 years ago

1.4.6

5 years ago

1.4.5

5 years ago

1.4.4

5 years ago

1.4.3

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago