amp.dev
amp.dev copied to clipboard
AMP-Selector : how to bind selected attribute dynamically on page load
<amp-selector class="tabs-with-selector" role="tablist" >
<div id="sample3-tab1" role="tab" aria-controls="sample3-tabpanel1" option="0" >Tab one</div>
<div id="sample3-tab2" role="tab" aria-controls="sample3-tabpanel2" option="1">Tab two</div>
<div id="sample3-tab3" role="tab" aria-controls="sample3-tabpanel3" option="2">Tab three</div>
</amp-selector>
- Let say I am dynamically populate three option inside amp-selector using amp-list.
- Now I want to select the second option by default on page load dynamically
- What is the right way to do that.
- amp is not allowing me to bind [selected] attribute.
If you want to evaluate binding on load (in an amp-list) you need to set the binding="always" attribute.