CngxAlertOn
projects/ui/feedback/alert/alert-on.directive.ts
Import#
import { CngxAlertOn } from '@cngx/ui/feedback'
Description#
Declarative state-to-alert bridge for scoped alert stacks.
Fires an alert when the bound CngxAsyncState transitions to error
(or optionally success). Only fires on actual transitions, not on
initial idle state.
Alerts route through the injected CngxAlerter - the environment
instance from provideFeedback(withAlerts()) or one provided by an
ancestor component. Every CngxAlertStack that resolves the same
instance renders them, filtered by scope:
<cngx-alert-stack scope="form" />
<button [cngxAsyncClick]="save"
[cngxAlertOn]="saveState"
alertError="Save failed"
alertScope="form"
[alertErrorDetail]="true">
Save
</button>Metadata#
Index#
Inputs#
string | undefinedScope for the alert - matches against CngxAlertStack's [scope] input.
The async state to watch. Optional - when omitted, falls back to
CNGX_STATEFUL from an ancestor/self component. A bare cngxAlertOn
attribute is treated as "no input bound".
undefined, { alias: 'cngxAlertOn', transform: (v) => (typeof v === 'string' ? undefined : v), }