Angular Parent-Scoped Error Bus Pattern

Angular Parent-Scoped Error Bus Pattern

A service is provided at the parent component level (providers: [ErrorBusService]). Each child component injects it and pushes its own set of known errors onto a shared observable stream (e.g. a Subject or BehaviorSubject). The parent subscribes to this stream once to aggregate all child errors and drive UI state — such as disabling a save button.

Advantage over @Output(): the parent does not need a handler per child and has no knowledge of which children exist. Children are self-registering; adding or removing a child requires no parent change.

Rules engine foundation: because all errors flow through a single stream owned by the parent, this pattern is natural grounds for a rules engine implemented in pure RxJS. Operators on the stream express cross-child logic — e.g. "disable save if any child has errors" or "treat step-2 errors as warnings only". Children do not need to self-identify beyond their step index, which is sufficient context for most rules.

See also: Reactive State Bus Pattern — this is the same pub/sub primitive applied to form validation state within a component subtree.