Jump to: navigation, search

Flow Control Elements

Flow Control elements are used to conditionally execute certain actions or repeat actions several times, based on values in an array.

<foreach>

Encapsulates a block of XML elements that are executed multiple times based on the number of items within the JavaScript array that is specified in the array attribute.

Attributes

Name

Type

Description

Default

Values

array

string (required)

Specifies a JavaScript array. The elements contained within the <foreach> element are executed a number of times, based on the content of the variable.

index

string (required)

Specifies the name of a JavaScript variable which contains the index value as the execution loops through the specified array. The index value can be used as a JavaScript variable within the XML content that is encapsulated by the <foreach> element.

<if>

Encapsulates a block of XML elements that are executed only if the cond attribute evaluates to the value true.

Attributes

Name

Type

Description

Default

Values

cond

string (required)

Specifies a JavaScript expression. If the value evaluates to a "falsy" condition (i.e. 0, "", false, undefined, null, NaN), then the elements that are contained within the <if> tag are not displayed or executed.

This page was last edited on February 10, 2015, at 22:16.

Feedback

Comment on this article:

blog comments powered by Disqus