Aliases

Aliases for SPX Components serve as alternative identifier references. Aliases are made available to component elements by expressing an as keyword in spx-component attribute values. Whenever an spx component value applies an alias, it can be used as an alternate reference to facilitate the association of events, nodes, or binds with components mounted within the DOM.

Multiple Component Aliases

In some situations you wish to apply multiple aliases to a single elements used by multiple components. You can optionally use a separator of , | or , characters. Below we are some components called dog, bird and shark - we give each of these components an alias


Usage

Its not uncommon you’ll have multiple occurrences of the same component within the DOM. Using alias identifiers allow you to isolate the associated references and target different component instances. Below a practical example of alias usage, wherein we have 2 separate instances of a component called counter.

In the above example, we provided aliases on each spx-component counter occurrence. One counter component was given an identifier alias value of foo and the other component was given an identifier value of bar.