この例を再現しようとしていますが、成功していません。mustache
次のように、テンプレートを使用してリストを追加します。
<ul>
<amp-list width=auto
height=100
layout=fixed-height
src="/assets/popular.json">
<template type="amp-mustache"
id="amp-template-id">
<li>
<a href={{url}}>{{title}}</a>
</li>
</template>
</amp-list>
</ul>
私の/assets/popular.json
ファイルは次のとおりです。
{
"items": [
{
"title": "amp-carousel",
"url": "https://ampbyexample.com/components/amp-carousel"
},
{
"title": "amp-img",
"url": "https://ampbyexample.com/components/amp-img"
},
{
"title": "amp-ad",
"url": "https://ampbyexample.com/components/amp-ad"
},
{
"title": "amp-accordion",
"url": "https://ampbyexample.com/components/amp-accordion"
}
]
}
しかし、私はそれを機能させることができませんjson
.テンプレート内の値が置き換えられていません.次のエラーが発生します:
Missing URL for attribute 'href' in tag 'a'
{{url}}
値が の内容に適切に置き換えられない理由がわかりませんjson
。
頭に必要なものを追加しましたscripts
。