JavaScript in template bindings
Pre-release
Pre-release
New features
- Support for using JavaScript expressions in model bindings
<span>{{firstName + ' ' + lastName}}</span>
<div [class.hidden]="itemCount == 0">Items available: {{itemCount}}</div>
- Support for using multiple bindings and
@include
statements in the same text node
<span>Hello {{name}}</span>
<span>{{firstName}} {{lastName}}</span>
<div>
@include header.html@
@child@
@include footer.html@
</div>
- Support for getting a list of beans from a model. Like with other getters, the returned list is a proxy object which can be modified to update the model
public interface EmployeesModel extends TemplateModel {
public List<Employee> getEmployees();
}
- An error message is shown to the end user if loading of a resource (CSS/JS/HTML) fails
- Client-side "debug" mode is now only based on whether the server-side production mode setting
?debug
in the query string has no effect
- Low level API for importing a bean into a given part of the model
TemplateModel.importBean(String modelPath, Object bean, Predicate<String> propertyNameFilter)
- Low level API for importing a list of beans, optionally filtering what bean properties to include
TemplateModel.importBeans(String modelPath, List<T> beans, Class<T> beanType, Predicate<String> propertyNameFilter)
Fixes
- For loops in templates are optimized to only update the changed parts instead of recreating the full DOM
- Changed default push transport from long polling to websockets
Element.getOuterHTML()
no longer throws exceptions for template elements with aclass
attribute
Demos
- Hello world template demo updated to use JavaScript expressions Java HTML
- Address book demo updated to use the new model API Java HTML
- Web site demo updated to use the new model API Java HTML
Tutorials
Binding Model Data in a Template
updated to cover JavaScript and attribute bindingsCreating Template Contents Dynamically Based on a List of Items
updated to support modification of the listBasic Integration of a Polymer Web Component
updated to better support developers not familiar with web components and bower
All changes
https://github.com/vaadin/hummingbird/issues?q=milestone%3A0.0.10