Skip to content

Template

Tim Rücker edited this page Dec 10, 2018 · 4 revisions

On the wiki page of the AbstractComponent has already been mentioned that this class is a experimental feature.

It can already be used productively, but is expected to receive additional features.

Class Members

A brief list of all class members with purposes.

public constructor(protected html: string)

Initializes the template with the html passed as first argument. The html can not be changed once the object was created.

public html: string

A simple getter for the html that was passed as first argument of the constructor.

public render(vars: any): string

vars must be an object containing key value pairs of variable names and values.

This method replaces placeholder values inside of the html ("${varName}") with the passed key-value-pairs and then returns the modified html.

The wrappers, which determine what is really a variable, can be customized with the following configuration:

ConfigRegistry.setConfig('template.expressionWrapper',['###','###']);

If e.g. this configuration is set, the following marker would be matched this ###variable### will be replaced

Clone this wiki locally