Computer >> Computer tutorials >  >> Programming >> Javascript

Polymer 1.0 dom-repeat should display index starting at 1 with HTML


Polymer.js is a JavaScript library created by Google that allows reusing the HTML elements for building applications with components.

To achieve this index, you need to set the index as:

<span>{{displayIndex(index)}}</span>

The displayIndex would be:

function (index) {
   return index + 1;
}

Let us see it in an example:

<div>Subject <span>{{displayIndex(index)}}</span></div>