Templates
Methods for setting, updating, and managing UI templates.
setTemplate() |
---|
Replaces a default template for a view. If there's an endpoint associated with the view, the API data is automatically passed into the template function as an argument. The template can be a simple string, or a function that returns a string. |
Syntax
/** * @param {String} id The template ID * @param {Function|String} template The template */ portal.setTemplate(id, template) |
Example
// Set the template for the "newPage" page portal.setTemplate('newPage', function (data) { return ` <h1>${data.title}</h1> ${data.pubdate} ${data.content}`; }); |
Copyright © 2022. Cloud Software Group, Inc. All Rights Reserved.