standard-dialogs
v0.0.1
Published
A Library that uses the Angular Material Framework for providing standard dialog implementations
Downloads
1
Readme
Standard Dialogs
A Library that uses the Angular Material Framework for providing standard dialog implementations
Installation
You can install Standard Dialogs through npm
npm install --save @lloydaf/standard-dialogs
Usage
After installing the package, make sure you import the module in the module you want to use this in.
For example, in app.module.ts,
...
import { StandardDialogsModule } from "@lloydaf/standard-dialogs";
...
@NgModule({
imports: [StandardDialogsModule],
})
export class AppModule{}
Dialogs
Currently provides three Dialog Implementations.
- Alert Prompt: This Dialog is used to alert the user or provide a message to the user. Can be used through AlertPromptService(see open() method).
- Confirm Prompt: This Dialog is used to get a confirmation action from the user. Can be used through ConfirmPromptService(see open() method).
- Custom Prompt: This Dialog is used to provide a custom functionality not implemented through the standard Dialogs. Can be used through CustomPromptService(see open()) method.
Using Dialogs
...
constructor(
private confirmService: ConfirmPromptService
// inject as you normally inject a service
)
...
openConfirmPrompt(){
this.confirmService.setContent('Are you sure you want to remove this category?');
this.confirmService.setTitle('Remove Category');
this.confirmService.open();
}
...
Buttons
Currently provides three Button Implementations
- Yes Button: This Button returns true when clicked, default text "Yes".
- No Button: This Button returns false when clicked, default text "No".
- Custom Button: This Button is used to provide a custom Button functionality not implemented through the standard Buttons. Needs to be built using ButtonBuilder.
Using Buttons
...
let yesButton = new YesButton();
let customButton = new ButtonBuilder().text('Hi').val('Bye').build();