# Sending two values using ng-click=send()

**URL:** <https://discourse.nodered.org/t/sending-two-values-using-ng-click-send/31566>\
**Category:** General\
**Created:** [14 August 2020 13:36 UTC](https://discourse.nodered.org/t/sending-two-values-using-ng-click-send/31566 "2020-08-14T13:36:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vangalvin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vangalvin/32/27213_2.png) [@vangalvin](https://discourse.nodered.org/u/vangalvin)\
**Post date:** [14 August 2020 13:36 UTC](https://discourse.nodered.org/t/sending-two-values-using-ng-click-send/31566/1 "2020-08-14T13:36:25Z")

</div>

I have a table cell set up to send back a value when its clicked. Ideally i would like to get it to send back two values in the payload.

```auto
<td ng-click="send({payload: device.deviceName, level:device.object.alertLevel})">{{device.object.alertLevel}}</td>

```

It seems I can send one or the other but not both. Is there a way to do this?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [14 August 2020 14:42 UTC](https://discourse.nodered.org/t/sending-two-values-using-ng-click-send/31566/2 "2020-08-14T14:42:28Z")

</div>

You can do it (I'll demonstrate below) but whats wrong with simple adding more properties to the payload?

Alt solution (put this in your ui\_template)...

```auto
<table>
    <tr>
        <td>
            <button ng-click="send2('hello', 'goodbye')">click me</button>
        </td>
    </tr>
</table>

<script>
    var $scope = this.scope;
    this.scope.send2 = function(payload1, payload2) { 
        $scope.send({payload:payload1});
        $scope.send({payload:payload2});
    }
</script>

```

#### Assumption...

- you are using ui\_template to make your table (you didn't say)

---

<div class="post-metadata">

**Author:** ![vangalvin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vangalvin/32/27213_2.png) [@vangalvin](https://discourse.nodered.org/u/vangalvin)\
**Post date:** [14 August 2020 23:37 UTC](https://discourse.nodered.org/t/sending-two-values-using-ng-click-send/31566/3 "2020-08-14T23:37:32Z")

</div>

> [@Steve-Mcl](#):
>
> `<button ng-click="send2('hello', 'goodbye')">click me</button>`

hi @Steve-Mcl  
yes I am using ui\_template to create the table, sorry for not mentioning that.

The table is being created by ng-repeat so I would need to set ng-click="send2('hello', 'goodbye')" using "device.deviceName" and "device.object.alertLevel"

I think i have found the way to pass this information

```auto
<td ng-click="send({payload: {deviceName: device.deviceName, aLvl: device.object.alertLevel}})">{{device.object.alertLevel}}</td>

```

adding the ineer curly brackets seems to allow it to work.

```auto
<td><button ng-click="send({payload: {deviceName: device.deviceName, aLvl: device.object.alertLevel}})">click me</button></td>

```

Using a button inside the table seems to work this way as well.

Thank you for your help 🙂 The table looks a lot nicer with buttons in it rather than just having a cell to click.

---

<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:** [28 August 2020 23:37 UTC](https://discourse.nodered.org/t/sending-two-values-using-ng-click-send/31566/4 "2020-08-28T23:37:42Z")

</div>

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