Help

95 views
Skip to first unread message

Alessandro Gnola

unread,
Jan 30, 2021, 12:53:49 PM1/30/21
to KnockoutJS

Hi.
I am a magento 2 developer and i have a problem in checkout .

I have this:

 <each args="data: currentBillingAddress().customAttributes, as: 'element'">
        <text args="$parent.getCustomAttributeLabel(element)"/>
     <br/>
</each>

I need to insert a increment variable.
Ex:
$a=0
$a++

if I could use php+html

 <each args="data: currentBillingAddress().customAttributes, as: 'element'">
<div id="<?php echo $a++; ?>
        <text args="$parent.getCustomAttributeLabel(element)"/>
     <br/>
</div>
</each>

Thanks for support.

Gunnar Liljas

unread,
Jan 30, 2021, 5:00:11 PM1/30/21
to knock...@googlegroups.com
Inside a loop there's a variable called $index that you can use.

--
You received this message because you are subscribed to the Google Groups "KnockoutJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to knockoutjs+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/knockoutjs/46f18b43-88a7-4ce6-932a-d46ba77e9c1an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages