StateKey

From Get docs
< @angular/platform-browserAngular/docs/9/api/platform-browser/statekey /
Revision as of 02:32, 6 December 2021 by Notes (talk | contribs) (Page commit)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


StateKey

type-alias

A type-safe key to use with TransferState.

See more...

type StateKey<T> = string & {
    __not_a_string: never;
};

Description

Example:

const COUNTER_KEY = makeStateKey<number>('counter');
let value = 10;

transferState.set(COUNTER_KEY, value);

© 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v9.angular.io/api/platform-browser/StateKey