Skip to content

nowzoo/ngx-message

Repository files navigation

@nowzoo/ngx-message

A service and component for displaying app messages.

Demo | Demo Source Code

Documentation

Quick start

npm i @nowzoo/ngx-message save

Import the module...

import { NgxMessageModule } from '@nowzoo/ngx-message';
@NgModule({
  imports: [
    NgxMessageModule.forRoot()
  ],
})
export class AppModule { }

Insert the component at a high level in your app...

<!-- app.component.html -->
<router-outlet></router-outlet>
<ngx-message></ngx-message>

Use the service to display messages...

import { NgxMessageService } from '@nowzoo/ngx-message';

export class MyComponent {

  constructor(
    private msgService: NgxMessageService
  ) { }

  showSuccess() {
    this.msgService.success('Hey, you are great!')
  }

  showWarning() {
    this.msgService.warn('Woops!')
  }

  showWait() {
    this.msgService.wait('Waiting...')
  }

}

Contributing

This project was generated with Angular CLI version 7.1.4.

git clone https://github.com/nowzoo/ngx-message.git

The library code is in projects/ngx-message.

The demo is in projects/ngx-message-demo

Build the library: ng build ngx-message

Serve the demo locally: ng serve ngx-message-demo

Unit tests

Run ng test ngx-message to execute the unit tests via Karma.

The library tests can also be run with Wallaby. Select the wallaby.js file in projects/ngx-message;