Wire variables
Variables are a great way to call a selection, operation or current state within a wire. Variables can be reused and are global to the wire, but are not stored in the system as a preference.
To create a variable, use the <assign> action tag. Variable names are defined as the property attribute of the assign. Create variables with a format of “var:name” within the property attribute. In order to call the variable, you must tell the assign what value to populate the property with when the assign action is invoked.
<action name="set-variable"> <assign property="var:color" value="Green" /> </action>In the example above, an attribute named color is defined as the variable. The value for the variable is defined in the assign tags value parameter.
Variables can be used by any tag within the wire. This is accomplished by using a variable token: [var:attribute]. Here we have added the variable content to a simple alert message.
<action name="set-variable"> <assign property="var:color" value="Green" /> <alert message="You like the color [var:color]" /> </action>
Requirements
None
Loading...
There was a problem loading this topic