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

  • Home
  • SEARCH
  • 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 8924985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:34:26+00:00 2026-06-15T07:34:26+00:00

As you’ll be able to tell from my question, I’m slowly learning EmberJS. I’ve

  • 0

As you’ll be able to tell from my question, I’m slowly learning EmberJS. I’ve read the great guide on routes and I felt ready to take on the world but then…

In my example, I thought the {{somethingView}} would be rendered and not the controller property {{somethingCtrl}}. Is this the correct behaviour? If so how would you render a property from the Ember.View?

The JS

window.App = Ember.Application.create({
    ready: function() {
        this.initialize();
    }
});


window.App.Router = Ember.Router.extend({
    root: Ember.Route.extend({
        index: Ember.Route.extend({
            route: '/',
            connectOutlets: function(router) {
                var controller = router.get('applicationController');
                controller.connectOutlet('garments');
            }
        })
    })
})

window.App.ApplicationView = Ember.View.extend({
    templateName: 'application',
});

window.App.ApplicationController = Ember.Controller.extend();


window.App.GarmentsController = Ember.Controller.extend({
    somethingCtrl: "Something in the controller"
});

window.App.GarmentsView = Ember.View.extend({
    templateName: 'garments',
    somethingView: "Something in the view"
});​

The DOM stuff

<script type="text/x-handlebars" data-template-name="application">
  <h1>Hi Ember</h1>
    {{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="garments">
  <h1>Garments</h1>
    {{somethingView}}<br>
    {{somethingCtrl}}
</script>

​

​
The Fiddle

  • 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-15T07:34:27+00:00Added an answer on June 15, 2026 at 7:34 am

    This behaviour is correct. These are my understandings of these ember core concepts:

    • Model: These objects represent the date that is handled by your application. These are the business objects that form the domain model of your Application.
    • Controller: A Controller is responsible for providing access to your models. Controllers have the property content, where models should be injected (a single Object for Ember.Controller and an array of objects for Ember.ArrayController). The Controller passes this content to your View. The Controller is the default context for your view. Therefore the behaviour you describe is expected.
    • View: The View is just intended for displaying issues. I personally use it mainly to do jQuery animations.

    But nonetheless it is possible to access the view instance in the template. You just have to use the variable with the name ‘view’ in your template. I updated your fiddle with a working example: http://jsfiddle.net/jPK8A/5/

    <script type="text/x-handlebars" data-template-name="garments">
      <h1>Garments</h1>
        {{view.somethingView}}<br>
        {{somethingCtrl}}
    </script>
    

    But to be clear: The most common case should be to access contents from your controller. It should be not often that you access variables of your view. You want to display date in your App and this date resides in models and should therefore be accessed through controllers. The most likely case might be, that you want to store labels in your view or something like that (labels that have to be computed).

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I have a text area in my form which accepts all possible characters from
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Does anyone know how can I replace this 2 symbol below from the string

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.