BackgroundComponent Show

The Show component shows or hides its content dependingon the evaluation of an expression defined in the ifattribute.

Example

This simple example only shows a user item when the propertyisMember of an object user from the local scope is truthy.

<show if="user.isMember">    <h3>${ user.fullName }</h3></show>
alias

{ default } from mahalo/components/show

Hierarchy

Index

Constructors

constructor

Properties

child

The child controller that is shown or hidden.

controller

The controller of the component.

element

element:Element

The component's element.

generator

The generator used to create the component.

if

if:boolean

The current result of the expression.

Static locals

locals:string[]

This static property defines which properties of the componentshould be available in its local scope which will be used by thecomponent's behaviors as well as by the defining element's children.

Values of this array represent the name of one of the component'sproperties that will be pushed to the local scope.

Example
export default class MyComponent extends Component {    static locals = ['firstName', 'lastName'];}

Static template

template:string = ""

Methods

Private createController

enter

  • enter(): void
  • Returns void

leave

  • leave(): void
  • Returns void

ready

  • ready(): void
  • Returns void

remove

  • remove(): void

update

  • Removes or appends the content when the expression result has changed.

    Parameters
    • value: any
    Returns ComponentController

Object literals

Static attributes

attributes:object

if

if:string = "."

Static bindings

bindings:object

if

if:string = "update"

Static inject

inject:object

controller

controller:ComponentController = ComponentController

element

element:Element = Element

generator

generator:ComponentGenerator = ComponentGenerator