
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@ashetm/ng-dialog
Advanced tools
This library provide a unique UI of 3 types of dialog; alert, confirm and form.
This library provide a unique UI of 3 types of dialog; alert, confirm and form.
Only Angular 14 and above are available.
You can install it with npm:
npm install @ashetm/ng-dialog
You only need to import DialogModule
through forRoot
static method.
...
import { DialogModule } from '@ashetm/ng-dialog';
...
@NgModule({
...
imports: [
...
DialogModule.forRoot(),
...
]
...
})
export class AppModule { }
The serviec to use is DialogService#openDialogAlert
, it's definition is:
openDialogAlert(
title: string,
body?: string,
{ closeLabel }?: Record<'closeLabel', string>
): DialogRef;
And it returns dialog reference DialogRef
, here is the exposed members:
type
returns an EDialogType
value with value of 'alert'getInstanceId()
returns a number
of instance idonBeforeClose(fn: () => boolean = () => true)
returns Observable<void>
and can pass a function handler to execute before closing, close the dialog alert if it returns true, else it stays openedExample:
constructor(
...
private readonly _dialogService: DialogService
...
) { }
openAlert(): void {
this._dialogService.openDialogAlert('Sample Title');
}
The serviec to use is DialogService#openDialogConfirm
, it's definition is:
openDialogConfirm(
title: string,
body?: string,
{ closeLabel, okLabel }?: Record<'closeLabel' | 'okLabel', string>
): DialogConfirmRef;
And it returns dialog reference DialogConfirmRef
, here is the exposed members:
type
returns an EDialogType
value with value of 'confirm'getInstanceId()
returns a number
of instance idonBeforeClose(fn: () => boolean = () => true)
returns Observable<void>
and can pass a function handler to execute before closing, close the dialog if it returns true, else it stays openedonBeforeDecision(fn: (decision: boolean) => boolean = (decision: boolean) => true)
returns Observable<boolean>
observable that returns the decision made by the user/client and can pass a function handler to execute before closing, close the dialog if it returns true etlse it stays openedExample:
constructor(
...
private readonly _dialogService: DialogService
...
) { }
openConfirm(): void {
this._dialogService.openDialogConfirm('Sample Title');
}
The service to use is DialogService#openDialogForm
, it's definition is:
openDialogForm<T extends TemplateRef<unknown>, U = any>(
title: string,
template: T,
{ closeLabel, okLabel }?: Record<'closeLabel' | 'okLabel', string>
): DialogFormRef<U>;
And it returns dialog reference DialogFormRef<U>
, here is the exposed members:
type
returns an EDialogType
value with value of 'alert'getInstanceId()
returns a number
of instance idonBeforeClose(fn: () => boolean = () => true)
returns Observable<void>
and can pass a function handler to execute before closing, close the dialog alert if it returns true, else it stays openedonBeforeData(fn: (data: U) => boolean = (_: U) => true)
returns Observable<U>
observable that returns the data of the form written by the user/client and can pass a function handler to execute before closing, close the dialog if it returns true etlse it stays openedIt also needs to tag ng-template
with the directive dialogFormBodyComponent
, that requires also to bind formGroup
directive. And also take reference of that ng-template
as DialogFormBodyComponent
.
Example:
...
<ng-template #dialogFormBodyComponent="DialogFormBodyComponent"
dialogFormBodyComponent
[formGroup]="formGroup">
Name: <input formControlName="name" />
</ng-template>
...
formGroup: FormGroup = new FormGroup({
name: new FormControl('Sample name')
});
...
constructor(
...
private readonly _dialogService: DialogService
...
) { }
openForm(template: DialogFormBodyComponentDirective): void {
this._dialogService.openDialogForm('Sample Title', template);
}
FAQs
This library provide a unique UI of 3 types of dialog; alert, confirm and form.
We found that @ashetm/ng-dialog demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.