@pwc-suman/global-message
v0.0.3
Published
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.2.0.
Downloads
3
Readme
GlobalMessage
This library was generated with Angular CLI version 15.2.0.
Code scaffolding
Run ng generate component component-name --project global-message
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project global-message
.
Note: Don't forget to add
--project global-message
or else it will be added to the default project in yourangular.json
file.
Build
Run ng build global-message
to build the project. The build artifacts will be stored in the dist/
directory.
Publishing
After building your library with ng build global-message
, go to the dist folder cd dist/global-message
and run npm publish
.
Running unit tests
Run ng test global-message
to execute the unit tests via Karma.
Further help
To get more help on the Angular CLI use ng help
or go check out the Angular CLI Overview and Command Reference page.
How to use
import { GlobalMessageModule } from '@pwc-suman/global-message' in your app.module.ts file and add GlobalMessageModule in imports array.
Add public globalMessageService: GlobalMessageService in constructor of your app.component.ts file.
Add <lib-global-message [message]="messageData.message" [type]="messageData.type" [closable]="messageData.closable" [width]="messageData.width" [textColor]="messageData.textColor" [backGround]="messageData.backGround" [borderColor]="messageData.borderColor" [time]="messageData.time" *ngIf="globalMessageService.messageData$ | async as messageData"> in your app.component.html. Where [type] is optional (default value 'success'), [closable] is optional (default value false), [width] is optional (default value 40%), [textColor] is optional (default value '#000'), [backGround] is optional (default value 'transparent'), [borderColor] is optional (default value '#0097E0'), [time] is optional (default value 3000). Note: If you provide [closable]='true', [time] won't have any effect.
Now add private globalmsgService: GlobalMessageService inside constructor of any componet from where you want to show the message and use globalmsgService.add() method. import { GlobalMessageService } from '@pwc-suman/global-message'
Example: this.globalmsgService.add({message: 'hello',time: 3000, closable: true, width:'60%', textColor:'red', backGround:'lightgreen',borderColor:'red'}) where only message is required and others are optional.