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

PolymerJavascriptWeb DevelopmentFront End Scripts

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>
raja
Published on 10-Apr-2018 08:28:16
Advertisements