1.0.3 • Published 6 years ago

@nowzoo/ngx-message v1.0.3

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

@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...')
  }

}

API

const NGX_MESSAGE_HIDE_DELAY

const NGX_MESSAGE_HIDE_DELAY: InjectionToken<number>

How long in milliseconds success and warn messages stay visible before being automatically hidden. Default: 3000. You can provide a different value:

{provide: NGX_MESSAGE_HIDE_DELAY, useValue: 5000}

enum NgxMessageContext

enum NgxMessageContext  {
  warn = 'warn',
  success = 'success',
  wait = 'wait'
}

interface INgxMessage

interface INgxMessage {
  message: string;
  context: NgxMessageContext;
}

NgxMessageService

Properties
  • message$: Observable<INgxMessage>
Methods
  • show(message: string, context: NgxMessageContext, hide: boolean)
  • hide()
  • wait(message: string)
  • success(message: string)
  • warn(message: string)

NgxMessageComponent

Contributing

See the repo README for how to test and build this library.

1.0.3

6 years ago

1.0.1

6 years ago

0.0.60

7 years ago

0.0.59

7 years ago

0.0.58

7 years ago

0.0.57

7 years ago

0.0.49

7 years ago

0.0.47

7 years ago

0.0.46

7 years ago

0.0.45

7 years ago

0.0.37

7 years ago

0.0.35

7 years ago

0.0.34

7 years ago

0.0.31

7 years ago

0.0.25

7 years ago

0.0.24

7 years ago

0.0.23

7 years ago

0.0.22

7 years ago

0.0.21

7 years ago

0.0.20

7 years ago

0.0.19

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago