You can open a popup dialog in Batch Explorer to ask for confirmation to the user, fill a small form, etc.
First you need to import the DialogService
import { DialogService } from "@batch-flask/ui/dialogs";
constructor(private dialog: DialogService) {}
Simplest confirmation dialog that do some action when user confirm.
this.dialog.confirm("Are you sure?", {
yes: () => this.otherService.doSomething(),
})
You can also have a description to detail a bit more what the user is about to confirm
this.dialog.confirm("Are you sure?", {
description: "This cannot be reverted.",
yes: () => this.otherService.doSomething(),
})
You can also open any component as a dialog. For that you'll need to first add the component to the entryComponents list of the module
@NgModule({
...
entryComponents: [
MyDialogComponent
],
...
})
then just call open(Note that this is just a proxy function to material MatDialog open)
const ref = this.dialog.open(MyDialogComponent);
reg.componentInstance # If you want to set some variables.