Client Side Template



Specifies alternative text in a template when a data value is missing.

In some cases the data you pass in to the template expander will have missing data. The || directive allows you to specify alternative text in the template when a data value is missing. For example, consider the following data object:

    employees: [
        {firstname: 'Fred', lastname: 'Smith', city: 'Boston'},
        {firstname: 'Laura', lastname: 'Linneker'}

The 'city' property has been specified for the first object in the 'employees' array, but not the second.

    Employee name: {firstname} {lastname} City: {city||Not available}<br>

The text to display for a missing value is specified in the placeholder after a || delimiter. In the template shown above, the missing text for the {City} property has been specified as 'Not available'. The template above gives us the following result for our data object:

Employee name: Fred Smith City: Boston
Employee name: Laura Linneker City: Not available