{ "id": "api/platform-browser/StateKey", "title": "StateKey", "contents": "\n\n
\n
\n
\n \n API > @angular/platform-browser\n
\n \n
\n \n
\n

StateKeylink

\n \n \n \n \n \n
\n \n \n\n
\n \n
\n

A type-safe key to use with TransferState.

\n\n

See more...

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

Descriptionlink

\n

Example:

\n\nconst COUNTER_KEY = makeStateKey<number>('counter');\nlet value = 10;\n\ntransferState.set(COUNTER_KEY, value);\n\n\n \n
\n\n\n \n\n\n
\n
\n\n\n" }