• Decorator that automatically dispatches the return value of a decorated function to the Redux store using ngRedux.dispatch().

    // These dispatches will be scoped to the substore as well, as if you
    // had called ngRedux.configureSubStore(...).dispatch(numLines).

    @Dispatch
    addCode(numLines: any) {
    // Dispatching from the sub-store ensures this component instance's
    // subStore only sees the 'ADD_LOC' action.
    return { type: 'ADD_LOC', payload: numLines };
    }

    In the above example, the addCode function is decorated with @Dispatch. Anytime the addCode function is called, its return value will automatically be dispatched to the Redux store using ngRedux.dispatch().

    Remarks

    This decorator assumes that the component instance has an ngRedux property that refers to a valid NgRedux instance. If the component instance does not have an ngRedux property, an error will be thrown.

    Returns

    The PropertyDescriptor.

    Parameters

    • target: any

      The target class instance.

    • functionName: string | number | symbol

      The name of the decorated function.

    • Optional descriptor: PropertyDescriptor

      The object PropertyDescriptor.

    Returns any

Generated using TypeDoc