The core library, aurelia-templating-resources
, provides a set of standard behaviors, built on top of aurelia-templating
, which can be used in any Aurelia template.
The show
attribute controls the visibility of the element, based on the value of the expression it is bound to:
<template> <p show.bind="hasError">An error occurred.</p> </template>
In this example, the p
element will be visible only when the model's hasError
property is truthy.
This attribute works by injecting a CSS class either in the document head or in the nearest ShadowDOM root, and by adding this CSS class on the element whenever it should be hidden. This CSS class simply sets the display
property to none
.