0.0.2 • Published 3 years ago

ionic-http-error-toast v0.0.2

Weekly downloads
10
License
-
Repository
-
Last release
3 years ago

IonicHttpErrorToast

This library was generated with Angular CLI version 10.1.6.

Installation

npm install @jorns/ionic-http-error-toast

Usage

Import IonicHttpErrorToastModule into your AppModule.

Default settings:

to Use with the default settings provide an empty object to the forRoot(). IonicHttpErrorToastModule.forRoot({}),

Customize:

The forRoot method takes a type of IConfig. All properties are optional. You can pass in your own httpErrorMessages and status codes to ignore. If you want to display error messages send from the server set useResponseError=true. The default value is false; Options takes an ToastOptions object with the same properties you would pass to a toast in Ionic.

IonicHttpErrorToastModule.forRoot({
      httpErrors: {
        httpErrorMessages: environment.httpErrorMessages,
        httpErrorIgnore: environment.httpErrorIgnore,
      },
      useResponseError: false,
      options: {
        position: 'bottom',
        buttons: [
          {
            icon: 'close',
            side: 'end',
            role: 'cancel',
            handler: () => {
              console.log('Cancel clicked');
            }
          }
        ],
        duration: null,
      }
  }),
0.0.2

3 years ago

0.0.1

3 years ago