[ Web Proxy ]
URL:
Viewing: https://angular.dev/api/core/StateKey [Back]  [Original]

StateKey Angular Skip to main content
menu
close
more_horiz
menuAPI
@angular/core

StateKey

Type Alias
stable

A type-safe key to use with TransferState.

On this page

    arrow_upward_alt Back to the top

    API

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

    Description

    A type-safe key to use with TransferState.

    Example:

    const COUNTER_KEY = makeStateKey<number>('counter');
    let value = 10;
    
    transferState.set(COUNTER_KEY, value);
    Jump to details

    Web Proxy Viewer  |  New URL  |  Original Page