angular / 5 / api / platform-browser / statekey.html

StateKey

type-alias

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

Description

A type-safe key to use with TransferState.

Example:

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

transferState.set(COUNTER_KEY, value);

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