Basic HTML templating using Template

Template provides a way to create templates using the HTML fragments. It contains HTML elements and various placeholders which are replaced with the values of the fields present in the data that is given to the template API to use in conjunction with the template text. For example, we may have a <div> element present in the body and, based on the data, we may add <ul> and <li> elements to it at runtime.

In this recipe, we will look at a typical usage of template and understand what it takes to define and use one.

Getting ready

Make sure that you have set up your development environment by following the Gear up for the Journey recipe outlined in Chapter 1.

Create a new folder named ch04 in the same folder where ...

Get Sencha Touch Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.