Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Each

The Each class renders a renderable for each item in a list.

Hierarchy

Constructors

constructor

  • Construct the each statement

    Parameters

    • items: Iterable<any>

      The items used to iterate through.

    • toRender: EachRenderFunction | Renderable | string

      The renderable to create for each item.

    • Default value indexName: string = "i"

      The index name used for the template string for each renderable.

    • Default value itemName: string = "item"

      The item name used for the template string for each renderable.

    Returns Each

Properties

Protected templates

templates: SimpleObject

Accessors

r

  • get r(): string
  • Getting for the HTML returned by the render function.

    Returns string

Methods

append

  • Appends templates to the existing templates object.

    Parameters

    • templates: SimpleObject

      Key-value pairs that map to a template rendered in StringLiteral's

    • Default value prioritize: boolean = false

      Whether or not to allow appended templates to override existing template properties

    Returns Renderable

empty

  • Sets the empty renderable which gets used if the list is empty.

    Parameters

    • toRender: Renderable | string

      The default renderable if the list is empty.

    Returns Each

Protected internalRender

render

  • Renders the internalRender function.

    Parameters

    Returns string

setIndexName

  • setIndexName(indexName: string): Each
  • Sets the index variable name used for the template generated by the each method.

    Parameters

    • indexName: string

      The new index name.

    Returns Each

setItemName

  • setItemName(itemName: string): Each
  • Sets the item variable name used for the template generated by the each method.

    Parameters

    • itemName: string

      The new item name.

    Returns Each

toString

  • toString(): string
  • Overrides the toString method called by JavaScript when string concatenate occurs

    Returns string

when

  • Turn on and off the ability for this element to render

    Parameters

    • condition: boolean

      The condition that determines whether or not the element can render.

    Returns Renderable

with

  • Sets the templates.

    Parameters

    • templates: SimpleObject

      Key-value pairs that map to a template rendered in StringLiteral's

    Returns Renderable

Generated using TypeDoc