Some examples

Api

RemoteData

RemoteData is used to annotate your request variables. It wraps all possible request states into one single union type. Use the parameters to specify:

T: The success value type.

E: The error value type (string by default).

NotAsked

NotAsked

When a RemoteData is an instance of the NotAsked class, it means that the request hasn't been made yet.

Loading

Loading<T>

When a RemoteData is an instance of the Loading class, it means that the request has been made, but it hasn't returned any data yet. The Loading class can contain a value of the same T type as the Success class. Useful when you want to use the last Success value while the new data being fetched.

Success

Success<T>

When a RemoteData is an instance of the Success class, it means that the request has been made successfully and the new data (of type T) is available.

Failure

Failure<E>

When a RemoteData is an instance of the Failure class, it means that the request has failed. You can get the error information (of type E) from the payload.

Pipes

isNotAsked

isNotAsked | RemoteData<any> : boolean

Returns true when RemoteData is a NotAsked instance.

isLoading

isLoading | RemoteData<any> : boolean

Returns true when RemoteData is a Loading instance.

anyIsLoading

anyIsLoading | Observable<RemoteData<any>>[] : boolean

Returns true when any RemoteData[] is a Loading instance.

isFailure

isFailure | RemoteData<any> : boolean

Returns true when RemoteData is a Failure instance.

isSuccess

isSuccess | RemoteData<any> : boolean

Returns true when RemoteData is a Success instance.

successValue

successValue | RemoteData<T> : (T | undefined)

Returns the Success payload (of type T) when RemoteData is a Success instance or undefined instead.

loadingValue

loadingValue | RemoteData<T> : (T | undefined)

Returns the Loading payload (of type T) when RemoteData is a Loading instance or undefined instead.

failureValue

failureValue | RemoteData<T, E> : (E | undefined)

Returns the Failure payload (of type E) when RemoteData is a Failure instance or undefined instead.