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 8783605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:51:42+00:00 2026-06-13T20:51:42+00:00

My model content.id contains a string, e,g 123: {{view Em.TextArea idBinding=content.id}} Instead of just

  • 0

My model “content.id” contains a string, e,g “123”:

{{view Em.TextArea idBinding="content.id"}}

Instead of just setting the id of this view to “123”, I’d like it to be “message-123”, basically customizing the string being used. Sadly, Ember does not allow bindings to be functions, which would solve my problem (I could define such a function on the controller).

What’s the best way to achieve this?

  • 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-13T20:51:43+00:00Added an answer on June 13, 2026 at 8:51 pm

    You could define a computed property in the controller (or elsewhere):

    The controller

    MyApp.ApplicationController = Ember.Controller.extend({
      content: "a-content",
    
      editedContent: function() {
          return "message-" + this.get('content');
      }.property('content')
    });
    

    The view

    MyApp.FooView = Ember.View.extend({
        tagName: 'p'
    });
    

    The template (where content is a String, here)

    {{#view MyApp.FooView elementIdBinding="editedContent"}}
        {{content}}
    {{/view}}
    

    And the JSFiddle is here.

    EDIT

    How can the view see the property editedContent since it belongs on the ApplicationController controller?

    The router, after started, automatically render the ApplicationView, or its template when there is no ApplicationView defined. If you want more detail, I suggest you to read the Ember guide: Understanding the Ember.js Router: A Primer.

    And {{editedContent}} directly get the controller editedContent property, because the default view context is its controller, as you can read in Ember Blog – 1.0 Prerelease:

    The {{#view}} helper no longer changes the context, instead maintaining the parent context by default. Alternatively, we will use the controller property if provided. You may also choose to directly override the context property. The order is as follows:

    • Specified controller
    • Supplied context (usually by Handlebars)
    • parentView’s context (for a child of a ContainerView)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a model class like this: class Note(models.Model): author = models.ForeignKey(User, related_name='notes') content
I have this view: @model MatchGaming.Models.ProfileQuery @{ ViewBag.Title = Index; } <h2>Index</h2> <script src=@Url.Content(~/Scripts/jquery.validate.min.js)
I have a model representing a Content item that contains some images. The number
My model contains a string field called longdescription which gets the value of the
I have some jQuery that looks like this: $.ajax({ type: POST, url: /Customer/CancelSubscription/<%= Model.Customer.Id
i have a String in my page, String response. This String contains the xml
I have a content model and a comment model. On insertion of comment I
How would I model a system that needs to be able to provide content
I have a model which defines a property with either markdown or html content.
I am trying to update a model that has translated content through globalize3 .

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.