makeStateKey

function

npm Package @angular/platform-browser
Module import { makeStateKey } from '@angular/platform-browser';
Source platform-browser/src/browser/transfer_state.ts

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

Description

Create a StateKey<T> that can be used to store value of type T 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/makeStateKey