makeStateKey

From Get docs
< @angular/platform-browserAngular/docs/11/api/platform-browser/makestatekey


makeStateKey

function

Create a StateKey<T> that can be used to store value of type T with TransferState.

See more...

makeStateKey<T = void>(key: string): StateKey<T>

Parameters
key string
Returns

StateKey<T>


Description

Example:

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

transferState.set(COUNTER_KEY, value);

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