Skip to content

blocks without containers guide #20

@Alexander-Taran

Description

@Alexander-Taran

from gitter chat

decide what use cases
and wrap it up in a small guide.
to not repeat yourself and give a link

Michael Prescott @michaelprescott 18:42
In my template, I've a variety of elements that are conditionally included with if.bind's. I've a new condition now that is very lengthy, yet makes sense to include in the template. Instead of revising all the other elements' if.bind's, I wonder if I can wrap them in a non-renderable element and have a single if.bind on that element. Regardless of how it resolves, I never want the container element to be in the DOM, I just want to use it as a tool for deciding which sub elements to include. Is this a sensible approach and how do I tell aurelia not to include that element?

Michael Bull @michaelbull 18:53
use tags @michaelprescott
you can wrap all of your inner elements with an outer template tag
and do the if on it
e.g.

hello

world

example

Michael Prescott @michaelprescott 19:04
oh, thanks! I didn't think of using within a for a custom element. Kinda makes sense now that you say it though.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions