linkStateKey
npm Package | @angular/platform-browser |
---|---|
Module | import { StateKey } from '@angular/platform-browser'; |
Source | platform-browser/src/browser/transfer_state.ts |
type StateKey<T> = string & {
__not_a_string: never;
};
linkDescription
A type-safe key to use with TransferState
.
Example:
const COUNTER_KEY = makeStateKey<number>('counter');
let value = 10;
transferState.set(COUNTER_KEY, value);