Map through an object in scala play framework map and include a file

Viewed 27

I am using scala play framework. On my scala.html page I am trying to loop through a list using a map function

In each loop I want to call an included page.

{profilesvm.profiles.map(profile=>{
   <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12">
       @cards(profile)
   </div>
 }

Right now the @cards is coming out printed as straight text. instead of pulling the code. Do I need to put something around the words @cards to make it run as scala?

1 Answers

Just had to adjust brackets.

  <div  class="col-md-10 col-sm-8 col-xs-12 ">
            @featuredProfiles.map{profiles=>
            <div id="featured-profiles" >
                <div class="list col-xs-12">
                    @for(p <- profiles.profiles){
                            <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 list-inside">
                        @cards(p){
                        }

                        </div>
                    }
                  }
                </div>
            </div>
Related