Templates

Template — html-structure with added variables, expressions and directives. When working with templates, a template engine is used lodash.template, which accesses the object settings, assigned when creating a widget.

In order to use a template, you must pass it to the tpl property:

var sitephone = CallGear.UI.createWidget('sitephone', {
    settings: settings,
    tpl: '<div>my template</div>'
});

This template is transformed into a dom element after calling render, and is accessible through a call to the getEl method.

sitephone.render();
var el = sitephone.getEl();

This is not the only way to bind a dom element to a widget. Also, when creating a widget, you can transfer the already prepared element:

var sitephone = CallGear.UI.createWidget('sitephone', {
    tpl: document.getElementById('sitephone_el')
});

In this case, do not use the render method, settings are not taken into account, since the finished element is already taken from the page as it is.