1.0.0 • Published 5 years ago

ngx-kc-notification v1.0.0

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

DEMO: https://kastriotcunaku.github.io/ngx-kc-notification/

Features

  • Modern UI
  • Smooth animation
  • Different notification types
  • Show multiple notifications in the same time
  • Use as prompt with action buttons
  • Easy to install and use

Dependencies

ngx-kc-notificationAngular
1.0.05.x

Install

npm install ngx-kc-notification --save

Setup

step 1: Add NgxNotificationModule to AppModule

import { CommonModule } from '@angular/common';

import { NgxNotificationModule } from 'ngx-notification';

@NgModule({
  imports: [
    CommonModule,
    NgxNotificationModule // NgxNotificationModule added
  ],
  bootstrap: [App],
  declarations: [App]
})
class AppModule {}

step 2: Add notification component tag on top of app.component.html

<ngx-notification></ngx-notification>
<!-- Your app template goes below -->

Use

import { Component } from '@angular/core';
import { NgxNotificationService } from 'ngx-notification';

@Component({
  selector: 'my-component',
  templateUrl: `
  <button (click)="show()">Show notification</button>
  `,
  styleUrls: []
})
export class MyComponent {

  constructor(private notification: NgxNotificationService) { }

  show() {
      this.notification.success('Your first notification');
  }
}

More examples and options can be found here

Options

Parameters

OptionTypeDescription
messagestringNotification message
titlestringNotification Title
buttonsNotificationButton[]Notification action buttons
optionsNotificationOptionsNotification options

NotificationButton

OptionTypeDescription
textstringButton text
callbackcallback functionOn click callback function
dismissbooleanDismiss notification on button click

NotificationOptions

OptionTypeDescription
durationnumberNotification duration in milliseconds
closeButtonbooleanShow X button on right corner
backdropDismissbooleanDismiss notification on backdrop click

License

MIT