CngxToastOn
projects/ui/feedback/toast/toast-on.directive.ts
Import#
import { CngxToastOn } from '@cngx/ui/feedback'
Description#
Declarative state-to-toast bridge.
Place on any element - fires a toast when the bound CngxAsyncState
transitions to success or error. Only fires on actual transitions,
not on initial idle state.
On a button
<button [cngxAsyncClick]="save"
[cngxToastOn]="saveState"
toastSuccess="Saved"
toastError="Save failed">
Save
</button>On a form
<form [cngxToastOn]="submitState"
toastSuccess="Form submitted"
toastError="Submission failed"
[toastErrorDetail]="true">
...
</form>Metadata#
Index#
Inputs#
The async state to watch. Optional - when omitted, the bridge falls back
to CNGX_STATEFUL injected from the host component (for example
CngxSelect.commitState). A bare cngxToastOn attribute (empty string)
is treated as "no input bound" so the fallback kicks in.
undefined, { alias: 'cngxToastOn', transform: (v) => (typeof v === 'string' ? undefined : v), }number | 'persistent'Duration for error toasts - 'persistent' means manual dismiss only.
'persistent'