By default, accessing an individual item in a template dom-repeat loop is by calling {{item}}
. Passing in an as=
attribute to template will allow you to switch out the default {{item}}
syntax for something that is more customized to the module you are working with. In this case, we want to grab the first and last name of a person, so we pass in as="person"
to template. We can now access the names using {{person}}
.
<dom-module id="basic-list">
<template>
<template is="dom-repeat" items={{list}} as="person">
<div>{{person.lastName}}, {{person.firstName}}</div>
</template>
</template>
</dom-module>