Compare checkbox checked value

#1

i'am sending msg.payload from dashboard template node to a mustache template node. what i want to do is to check if the input came from the first template is checked or not, in my second template. i have tried a lot of code but none of them works for me.
what do i missing here, and thank you.

>  <td>
>             <input type="checkbox" [checked]="{{payload.0.data8}} == 'true'">
>         </td
0 Likes

#2

i solve it. in template dashboard node

<td>
            <input type="checkbox" ng-model="msg.payload.data8" name="checkbox1" value="value1" class="toggle-column" ng-true-value="'checked'" ng-false-value="'unchecked'">
        </td>

in template mustache node

>  <td>
>             <input type="checkbox" {{payload.0.data8}}>
>         </td>
0 Likes

#3

Well, from what I know, JS does not allow property names to begin with a number, so that .0 does not look correct to me.

0 Likes

#4

my msg.payload is an array of object

0 Likes

#5

Correct, but in the mustache template syntax, that is how you reference elements of an array.

1 Like

#6

Ok, wasn't aware of reinventing the wheel. Thanks for the clarification.

0 Likes