Sharing a mustache template between <amp-list> and <amp-form>

Conveniently, we already have the solution. In the amp-list we just built, we included the attribute template="cart_summary_template". Now we can place a mustache template with id="cart_summary_template" anywhere in the page, and amp-list will populate this template with the JSON data it retrieves. Since we already have a template in the amp-form submit-success container, and this template works with similar JSON data, if we set the ID of this template to match the amp-list template ID, that is, cart_summary_template, then the amp-list should be able use it.

Note that we're faced with the same issue as earlier in this chapter: if we use the default amp-list behavior then it will ...

Get AMP: Building Accelerated Mobile Pages now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.