Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9237669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:35:07+00:00 2026-06-18T07:35:07+00:00

I have a handlebars template like this: <script type=text/x-handlebars data-template-name=sections> {{#each section in controller}}

  • 0

I have a handlebars template like this:

<script type="text/x-handlebars" data-template-name="sections">
  {{#each section in controller}}
    {{#linkTo "section" section}} {{ section.label }} {{/linkTo}}
  {{/each}}
</script>

and everything works fine.
My model object looks like this:

App.Section = DS.Model.extend({
 sectionDetail: DS.attr('number'),
 label: DS.attr('string'),
 cssClass: DS.attr('string')
});

and I would like to use the "cssClass" property inside the "#linkTo" helper. Now, how can it be done (syntactically)?

I tried this, but this obviously does not work, because using {{section.cssClass}} does not render the value of section.cssClass but the bare string "{{section.cssClass}}".

<script type="text/x-handlebars" data-template-name="sections">
  {{#each section in controller}}
    {{#linkTo "section" section class="{{section.cssClass}}"}} {{ section.label }} {{/linkTo}}
  {{/each}}
</script>

I can’t find a solution that does work, could someone point me in the right direction here, or it’s simple not possible to achieve what I want to do? Should I construct the links differently?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:35:08+00:00Added an answer on June 18, 2026 at 7:35 am

    For anyone else stumbling here, the solution is to use classNamesBindings.

    <script type="text/x-handlebars" data-template-name="sections">
      {{#each section in controller}}
        {{#linkTo "section" section classNameBindings="section.cssClass"}} 
          {{section.label }}
        {{/linkTo}}
      {{/each}}
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this view: <script type=text/x-handlebars data-template-name=articlesOne> <div class=main> <div id=articlesOne> <h2 id=article-title>{{App.ArticlesOneController.article.title}}</h2> <h3
i have a script handlebar.. <script id=ownerItem data-template-name='ownerItem' type=text/x-handlebars> {{value.UserName}} &nbsp;<button {{action remove on=click}}>Remove</button>
I have a product block in a template like this : <script type=text/x-handlebars-template id=tmpl-person>
I have a handlebars.js template, just like this: {{externalValue}} <select name=test> {{#each myCollection}} <option
I have the following in my page, ready to: <div id=result></div> <script id=some-template type=text/x-handlebars-template>
In my index.html I have the following template <script type=text/x-handlebars> {{#with ChatApp.messagesController}} {{view Ember.TextArea
So I've seen handlebars templates do this: <script id=some-template type=text/x-handlebars-template> </script> and am wondering
I have this code: if (this.template) { var template = Handlebars.compile( $(this.template).html() ); $(this.el).html(template());
I have a handlebars template in a public directory. I'd like to access the
For example, I have a script like this, which defines a new div, annotated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.