@angular/corecode
TransferState
Class
stable
A key value store that is transferred from the application on the server side to the application on the client side.
get
TGet the value corresponding to a key. Return defaultValue if key is not found.
@paramdefaultValue
T@returns
TonSerialize
voidRegister a callback to provide the value for a key when toJson is called.
@paramcallback
() => T@returns
voidDescription
A key value store that is transferred from the application on the server side to the application on the client side.
The TransferState is available as an injectable token.
On the client, just inject this token using DI and use it, it will be lazily initialized.
The values in the store are serialized/deserialized using JSON.stringify/JSON.parse. So only boolean, number, string, null and non-class objects will be serialized and deserialized in a non-lossy manner.
Jump to details