How can I call a template with a variable number of arguments with an Html type in the game?
I created a template in play2 defined as follows:
@(tabs: Html*) <div class="btn-group" style="margin-bottom:20px"> @for((tab,index) <- tabs.zipWithIndex){ <a class="btn btn-mini btn-info active" id="display-hierarchy-@index" href="javascript:void(0)"><i class="icon icon-random icon-white"></i></a> } </div> @for((tab,index) <- tabs.zipWithIndex){ <div id="display-hierarchy-tab-@index" class="onetab"> @tab </div> }
I tried calling him like
@views.html.tabs({ <a>tab1</a> },{ <a>tab2</a> })
I tried other varios combinations, but with an error:
type mismatch; found : scala.xml.Elem required: play.api.templates.Html
raisercostin
source share