CngxAudioStatus
projects/common/audio/status-mode/audio-status.directive.ts
Import#
import { CngxAudioStatus } from '@cngx/common/audio'
Description#
Status-mode audio bridge. Maps CngxAsyncState lifecycle transitions to
earcons via the status:earcon grammar — the audition counterpart of
CngxToastOn. Fires only on a real status transition, never on the initial
idle, and at most once per transition.
<button [cngxAsyncClick]="upload"
#upload="cngxAsyncClick"
[state]="upload.state"
[cngxAudioStatus]="'pending:tap, succeeded:success, failed:error'">
Upload
</button>The state source resolves the same way the feedback bridges do: an explicit
[state] input wins, otherwise it falls back to an ancestor's
CNGX_STATEFUL. The grammar keys are lifecycle statuses only — DOM-event
keys (click, focus, …) belong to [cngxAudio] and are rejected with a
dev-error. succeeded/failed are accepted as aliases for success/error.
Metadata#
Index#
Inputs#
Suppress this element's audio without unbinding.
false, { transform: booleanAttribute }number | undefinedPer-element volume multiplier in [0, 1]; unset uses the engine volume.
The status:earcon grammar, e.g. 'pending:tap, succeeded:success'.
'', { alias: 'cngxAudioStatus' }The async state to watch. Optional — when omitted, the bridge falls back to
an ancestor CNGX_STATEFUL. A bare [state] attribute (empty string) is
treated as "no input bound" so the fallback kicks in.
undefined, { transform: (v) => (typeof v === 'string' ? undefined : v), }