Class Export
export state(stateNameExpr: string, styles: AnimationStyleMetadata) : AnimationStateDeclarationMetadata
state
is an animation-specific function that is designed to be used inside of Angular2's
animation
DSL language. If this information is new, please navigate to the
component animations metadata
page to gain a better understanding of how animations in Angular2 are used.
state
declares an animation state within the given trigger. When a state is
active within a component then its associated styles will persist on
the element that the trigger is attached to (even when the animation ends).
To animate between states, have a look at the animation transition DSL function. To register states to an animation trigger please have a look at the trigger function.
The void
state
The void
state value is a reserved word that angular uses to determine when the element is not
apart
of the application anymore (e.g. when an ngIf
evaluates to false then the state of the
associated element
is void).
The *
(default) state
The *
state (when styled) is a fallback state that will be used if
the state that is being animated is not declared within the trigger.
Usage
state
will declare an animation state with its associated styles
within the given trigger.
stateNameExpr
can be one or more state names separated by commas.styles
refers to the styling data that will be persisted on the element once the state has been reached.
Example (live demo)
exported from @angular/core/index defined in @angular/core/src/animation/metadata.ts