Thymeleaf template related functions.
Example
var thymeleafLib = require('/lib/xp/thymeleaf');
Methods
(static) render(view, model) → {string}
This function renders a view using thymeleaf.
Parameters:
Name | Type | Description |
---|---|---|
view |
Location of the view. Use |
|
model |
object | Model that is passed to the view. |
Returns:
The rendered output.
- Type
- string
Example
var view = resolve('view/fruit.html');
var model = {
fruits: [
{
name: 'Apple',
color: 'Red'
},
{
name: 'Pear',
color: 'Green'
}
]
};
var result = thymeleafLib.render(view, model);