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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:37:10+00:00 2026-06-12T02:37:10+00:00

Case I.Binding template to instance of view. For example, let’s say I have a

  • 0

Case I.Binding template to instance of view.

For example, let’s say I have a template:

    <script type="text/x-handlebars" data-template-name="instance-template">
        <b> Name: </b> {{ name }}
    </script>

I can then bind an instance of view to it and append to the document ( for simplicity sake the param name is declared in view, as opposed to binding to some control layer) :

App.instanceView = Ember.View.create({
    templateName: 'instance-template',
    name: 'hello world'
}).append();

What exactly is going on behind the scenes here? By specifying a template name, is this instance of view somehow taking a template and compiling it with the parameters passed in the background?

Case II. Binding template to class view, template not named.

If, however, I want to bind a template to a class view such as:

App.ViewClass = Ember.View.extend({
    name: 'hello world',
});

The documentation uses a template of this form:

<script type="text/x-handlebars">
    {{ #view App.ClassView }}
        This part renders: {{ name }} 
    {{ /view }}
</script>

Please note, when I do this, for some reason this does not work. The quote ‘This part renders: ‘ in the template actually renders, however the {{ name }} tag is not rendered. I have no idea why.

Case III. template bind to class view, template is named.

In addition, if I name the template above:

<script type="text/x-handlebars" data-template-name = 'class-template'>
    {{ #view App.ClassView }}
        This part renders: {{ name }} 
    {{ /view }}
</script>

and change the view to

App.ViewClass = Ember.View.extend({
    templateName: 'class-template',
    name: 'hello world',
});

nothing renders at all. Again I do not see what is going on here.

  • 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-12T02:37:12+00:00Added an answer on June 12, 2026 at 2:37 am

    Case 1
    Yah pretty much. The view is rendering (and we are assuming the context is the view) then when we see {{name}} this will be equivalent to instanceView.get('name').

    Case 2
    Anonymous templates do not change context. When you define a template inside of {{#view}} the context won’t change. To get the view’s context that was used with the {{#view}} helper you’ll need to use view.name. For example:

    App.ViewClass = Ember.View.extend({
        name: 'hello world',
    });
    
    <script type="text/x-handlebars">
        {{name}} <!-- lets pretend this is "something else" -->
        {{#view App.ClassView}}
            This part renders: {{name}} <!-- "something else" -->
            {{view.name}} <!-- "hello world" -->
        {{/view}}
    </script>
    

    Case 3
    This example makes no sense and should probably have an assertion fail with Ember (non minified version). You are defining a view that uses a template, then inside that template rendering that same view again with an anonymous template. If this is you intended meaning could you please provide a use case because there is probably a much simpler way to go about waht you are trying to accomplish.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having difficulty correctly Data Binding my models in the view. I have a
Case example: I have a long list of items, and when I put my
Case One Say you have a little class: class Point3D { private: float x,y,z;
Case Currently I'm working on database seeding script, executed with sqlcmd . For example
I've run into a problem with data-binding inside control template while the property is
I have two controls contained within a data template. Control #1 is a TextBlock
I have an observableArray of records which I bind using a template binding. This
I have a control template that is bound to a model property, lets say
I was wondering if it's possible to have the following type of binding, and
I currently have a data template I apply to cells to get them styled

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.