MCPcopy Create free account
hub / github.com/ampproject/amphtml / renderTemplateArray

Method renderTemplateArray

src/service/template-impl.js:118–127  ·  view source on GitHub ↗

* Renders the specified template element using the supplied array of data * and returns an array of resulting elements. * @param {!Element} templateElement * @param {!Array<!JsonObject>} array * @return {!Promise<!Array<!Element>>}

(templateElement, array)

Source from the content-addressed store, hash-verified

116 * @return {!Promise<!Array<!Element>>}
117 */
118 renderTemplateArray(templateElement, array) {
119 if (array.length == 0) {
120 return Promise.resolve([]);
121 }
122 return this.getImplementation_(templateElement).then((impl) => {
123 return array.map((item) => {
124 return this.render_(impl, item);
125 });
126 });
127 }
128
129 /**
130 * Discovers the template for the specified parent and renders it using the

Callers 2

test-template.jsFile · 0.80

Calls 4

getImplementation_Method · 0.95
render_Method · 0.95
resolveMethod · 0.80
thenMethod · 0.45

Tested by

no test coverage detected