Skip to content

Angular Services

Complete API reference for @asyncflowstate/angular.

createFlow

Core factory function for generating flow state containers with RxJS observable support.

ts
function createFlow<TInput, TOutput>(
  action: (...args: TInput[]) => Promise<TOutput>,
  options?: FlowOptions<TInput, TOutput>,
): AngularFlow<TInput, TOutput>;

Properties

PropertyTypeDescription
state$BehaviorSubject<FlowState>Observable stream of state updates
statusFlowStatusCurrent snapshot: idle, loading, etc.
loadingbooleanCurrent snapshot of loading state
dataTOutput | nullCurrent snapshot of data
errorError | nullCurrent snapshot of error

Methods

MethodTypeDescription
execute(...args) => Promise<T>Run the action
reset() => voidReset state
destroy() => voidClean up subscriptions

flowConfigProvider

Sets global configuration for the Angular application using standard DI providers.

ts
// app.module.ts or app.config.ts
import { provideFlowConfig } from "@asyncflowstate/angular";

providers: [
  provideFlowConfig({
    retry: { maxAttempts: 3 },
    loading: { minDuration: 400 },
  }),
];

createFlowSequence

Executes incremental steps with isolated states, exposed as an observable sequence.

ts
const sequence = createFlowSequence(steps);
// sequence.state$ | async

Built with by AsyncFlowState Contributors
Open Source · MIT License