I have ten fields in a database 'add_costs_1'
, 'add_costs_2'
, 'add_costs_3'
to 'add_costs_10'
I am using them in a repeat and so want to reference them dynamically
If I reference them manually ie with '.add_costs_1'
at the end, like this
dmx-html="$index == 0 ? '<i class=\'fa-ban fas\'></i>' : sc_ad_add_costs_mq.data.qp_ad_add_costs_mq[add_costs_id-1].add_costs_1"
then the results are as expected (but only reference the first field repeatedly, many times).
If I try to reference them dynamically then I cannot get a result. So I have tried things like
dmx-html="$index == 0 ? '<i class=\'fa-ban fas\'></i>' : add_costs_$index"
dmx-html="$index == 0 ? '<i class=\'fa-ban fas\'></i>' : add_costs_{{$index}}"
dmx-html="$index == 0 ? '<i class=\'fa-ban fas\'></i>' : add_costs_[$index]"
dmx-html="$index == 0 ? '<i class=\'fa-ban fas\'></i>' : 'add_costs_' + $index"
but nothing I do seems to work in the 'dmx-html'
.
I know I don’t need to put
dmx-html="$index == 0 ? '<i class=\'fa-ban fas\'></i>' : sc_ad_add_costs_mq.data.qp_ad_add_costs_mq[add_costs_id-1].add_costs_1"
and I can just use
dmx-html="$index == 0 ? '<i class=\'fa-ban fas\'></i>' : add_costs_1"
But I’m still stuck on how to make that last digit dynamic.
Community Page
Last updated:
Last updated: