# Template Help displaying objects in a list

**URL:** <https://discourse.nodered.org/t/template-help-displaying-objects-in-a-list/61773>\
**Category:** Dashboard\
**Created:** [25 April 2022 22:42 UTC](https://discourse.nodered.org/t/template-help-displaying-objects-in-a-list/61773 "2022-04-25T22:42:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmorris644](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jmorris644/32/31964_2.png) [@jmorris644](https://discourse.nodered.org/u/jmorris644)\
**Post date:** [25 April 2022 22:42 UTC](https://discourse.nodered.org/t/template-help-displaying-objects-in-a-list/61773/1 "2022-04-25T22:42:10Z")

</div>

I need a little help with Templates. I have a msg.on topic that has an array of objects with a single field called friendlyName. I want to iterate through these objects and display the friendly names. Here is my code. I do not get details displayed

```auto
<table>
    <tr ng-repeat="obj in msg.on">
        
        <td> <md-button ng-click="send({Baction:'OFF',topic:obj.friendlyName})"> OFF </md-button> {{obj.friendlyName}}
            
        </td>
    </tr>
    
</table>

```

here is a debug output of the array with a single object  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/7/872ef1e3d676cf4712dc4f34dc49c824991fdf52.png)

The template also adds an OFF button that I can click to send an appropriate command

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [26 April 2022 01:03 UTC](https://discourse.nodered.org/t/template-help-displaying-objects-in-a-list/61773/2 "2022-04-26T01:03:36Z")

</div>

This is working - just set the tab/group for the template

```auto
[{"id":"216f7aa7229e3549","type":"ui_template","z":"73a94477.15d104","group":"","name":"","order":6,"width":"5","height":"5","format":"<table>\n <tr ng-repeat=\"obj in msg.on\">\n\n <td>\n <md-button ng-click=\"send({Baction:'OFF',topic:obj.friendlyName})\"> OFF </md-button> {{obj.friendlyName}}\n\n </td>\n </tr>\n\n</table>","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":true,"templateScope":"local","className":"","x":1460,"y":940,"wires":[["d5bf2306e5d0819b"]]},{"id":"b390ec0ba236080f","type":"inject","z":"73a94477.15d104","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1180,"y":940,"wires":[["a6c081065c18a063"]]},{"id":"a6c081065c18a063","type":"function","z":"73a94477.15d104","name":"","func":"msg.on = [{ \"friendlyName\": \"mudroom\" }, { \"friendlyName\": \"test\" }]\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1320,"y":940,"wires":[["216f7aa7229e3549"]]},{"id":"d5bf2306e5d0819b","type":"debug","z":"73a94477.15d104","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1610,"y":940,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![jmorris644](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jmorris644/32/31964_2.png) [@jmorris644](https://discourse.nodered.org/u/jmorris644)\
**Post date:** [26 April 2022 12:46 UTC](https://discourse.nodered.org/t/template-help-displaying-objects-in-a-list/61773/3 "2022-04-26T12:46:19Z")

</div>

Thanks. That worked great.

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [26 April 2022 16:00 UTC](https://discourse.nodered.org/t/template-help-displaying-objects-in-a-list/61773/4 "2022-04-26T16:00:27Z")

</div>

No problem, can you mark as solution please ?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 May 2022 16:00 UTC](https://discourse.nodered.org/t/template-help-displaying-objects-in-a-list/61773/5 "2022-05-10T16:00:46Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
