-
Notifications
You must be signed in to change notification settings - Fork 5
Template Syntax
guankaishe edited this page Aug 19, 2015
·
9 revisions
Where insert sub-elements into parent DOM Tree or remove. Example
<z-if is="{expression}">
<!-- sub element -->
<!-- sub element -->
</z-if>
Repeat a template element based on an Array
on the viewModel.
Example
<ul>
<z-repeat items="{users}">
<li>
{{name}} {{email}}
</li>
</z-repeat>
</ul>
z-template
as an element holder of the viewModel. Zect will copy all attributes from z-template
element (include class
and id
) to instance's $el
. class
attribute will be merged.
Example
<!-- HTML template-->
<z-template title="{title}" class="my-component">
{title}
</z-template>
<!-- use -->
<my-component z-data="{title: 'hello'}" class="comp"></my-component>
Render result:
<my-component title="hello" class="comp my-component">
hello
</my-component>
Binding data to text-content at that position. The text result of the express will be escaped.
Binding data to html-content at that position. Th result of the express will not
be escaped and render to actual element.