How can I get the index of each item that is rendered with Mustache inside an Amp-list? Here's an example of my html :
<amp-list id=""
layout="fixed-height"
height="130"
binding="no"
items="."
single-item="."
src="https://api.myjson.com/bins/6jjqc">
<template type="amp-mustache">
<amp-carousel carousel-preview"
width="auto"
height="130"
layout="fixed-height"
type="carousel">
<a on="tap:carousel-with-carousel-preview.goToSlide(index={{@index}})" class="dayweek">{{day}}</a>
</amp-carousel>
</template>
</amp-list>
I have used {{@index}} but since this HTML is rendered inside C#, C# thinks @index is a variable and sends an error
"rendered inside C#" - I assume you mean it is rendered by a Razor View?
In that case you will need to escape your
@
by doubling it, to have Razor output a literal@
without interpreting it as a variable.See the docs: