# Template node with ng-repeat won't show array items

**URL:** <https://discourse.nodered.org/t/template-node-with-ng-repeat-wont-show-array-items/40989>\
**Category:** Dashboard\
**Created:** [14 February 2021 22:33 UTC](https://discourse.nodered.org/t/template-node-with-ng-repeat-wont-show-array-items/40989 "2021-02-14T22:33:22Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![clickworkorange](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/clickworkorange/32/12109_2.png) [@clickworkorange](https://discourse.nodered.org/u/clickworkorange)\
**Post date:** [14 February 2021 23:22 UTC](https://discourse.nodered.org/t/template-node-with-ng-repeat-wont-show-array-items/40989/4 "2021-02-14T23:22:18Z")

</div>

Ok, it's the repetition. The array cannot contain the same value twice. `["a","a","a"]` fails silently, `["a","b","c"]` works. Why is this?

**Edit:** [Error: ngRepeat:dupes - Duplicate Key in Repeater](https://docs.angularjs.org/error/ngRepeat/dupes)

> Duplicate keys are banned because AngularJS uses keys to associate DOM nodes with items.

Wow. Funny how I've never run into this before - I've been tinkering w. Node-RED on & off for _years_. A somewhat surprising feature of Angular.JS which probably should be mentioned in any `ng-repeat` tuts & boilerplate. Might save someone else the headache. The solution (if your array may contain duplicate values) is to tell Angular to generate DOM references by index instead:

```auto
<table>
    <tr ng-repeat="value in msg.payload track by $index">
        <td>{{value}}</td>
    </tr>
</table>

```

**Edit 2:** And of course all this can be seen in the JS error console, plain as day - the error message even includes a link to the article on Angular's website... Doh!

---

_[View the full topic](https://discourse.nodered.org/t/template-node-with-ng-repeat-wont-show-array-items/40989)._
