Skip to main content
cngx-src documentation

DialogRef

Interface

projects/common/dialog/dialog/dialog-ref.ts

Referenced by#

Import#

import { DialogRef } from '@cngx/common/dialog'

Description#

Signal-based dialog reference.

  • Outside (parent template): access via exportAs - #dlg="cngxDialog"
  • Inside (dialog content): access via DI - inject(DIALOG_REF)

Index#

Instance Properties#

id#Signal
Readonly

Unique ID of this dialog instance.

lifecycle#Signal
Readonly

Current lifecycle state of the dialog.

result#Signal
Readonly

The typed result of the dialog.

  • undefined before the dialog closes (reset on each open())
  • 'dismissed' when dismissed via Escape or backdrop click
  • T when closed with an explicit value
submitState#CngxAsyncState
Readonly

Async state of the submit channel.

Populated when [submitAction] is set - tracks the submit lifecycle (idle -> pending -> success/error). When submitAction is not set, this is a static idle state.

Bind to any state consumer: <cngx-alert [state]="dlg.submitState" />.

Methods#

close#void
close(value: T)

Close the dialog with a typed result value.

@paramvalueT
dismiss#void

Dismiss the dialog without a result (Escape / backdrop).