title: How to inject Scala variable into html attribute (String) in Scala template HTML
body: <p>Let me explain my requirement. Currently we are using Scala template which has some html code and Scala attributes. </p>
  
  <p>Example <em>test.scala.html</em></p>
  
  <pre><code>@(hostName: String, token: String, protocol: String, supportEmail: String)
  @import helper._
  &lt;!DOCTYPE html&gt;
  
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;    
  &lt;/head&gt;
  &lt;table&gt;
  &lt;tr&gt;
              &lt;td&gt;&amp;nbsp;&lt;/td&gt;
              &lt;td style="color: #626262;"&gt;                
                  &lt;p style="font-size:14px;"&gt;
                      &lt;br/&gt;
                      Our app will let you access your company intranet.&lt;br/&gt;&lt;br/&gt;
                      Your activation code is &lt;b&gt;@token&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;
  
                      If you have any questions, please contact our &lt;a href="mailto:@supportEmail"&gt;support team&lt;/a&gt; anytime.
                      &lt;br/&gt;&lt;br/&gt;
                      Best regards,&lt;br/&gt;
                         The Support Team
                      &lt;/p&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
      &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>If you see the above code <code>@token</code> and <code>@supportEmail</code> is dynamic we are passing to Scala. </p>
  
  <p>Till now looks good. The requirement changes, the customer now wants us to read the content from the database. They want to save the actual html content (<em>table ... end of table</em>). </p>
  
  <p>So I took the code and stored it in a database column. I am able to pass this content to my view function by using <code>@Html</code>.</p>
  
  <p>Now my new Scala view function looks like the following:</p>
  
  <pre><code>@(hostName: String, token:String, protocol: String, supportEmail: String, content: String)
  @import helper._
  &lt;!DOCTYPE html&gt;
  
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;    
  &lt;/head&gt;
   @Html(content) 
  </code></pre>
  
  <p>
     </p>
  
  <p>Bu I am not able pass <code>@token</code> and <code>@supportEmail</code> dynamically. It is treated as a plain string. After rendering it looks like the following :</p>
  
  <blockquote>
    <p>Our app will let you access your company intranet, files and SaaS services from your device.</p>
    
    <p>Your activation code is @token</p>
    
    <p>If you have any questions, please contact our support team @supportEmail anytime.</p>
    
    <p>Best regards,<br>
       The support Team</p>
  </blockquote>
  
  <p>Can anyone explain me whats wrong with <code>@Html</code>, can I parse the dynamic content or not. If not is there any alternative. </p>