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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:59:20+00:00 2026-06-12T07:59:20+00:00

I think I have a problem understanding how the data loaded by controller should

  • 0

I think I have a problem understanding how the data loaded by controller should be binded and become available to the view. For the purpose of this question I have crafted a small example in jsFiddle that uses ember-rest to load data.

As you can see in the jsFiddle, what I want to achieve in this example is to bind my testData to BlockView which is rendered using the blocki template. What is an appropriate way to do this in Ember?

To get an idea of what the fiddle would look like when it is running properly replace the binding to blocksController to directly bind to the testData. I have done this in another version of the jsFiddle.

{{view App.BlockView blockiBinding="App.testData" }}

Of course the blocks render properly in this version — but that is not how I want to do this. I want to learn how to properly (as recommended by Ember) connect the blockController to the view and get the data from it. In a real scenario the data will be obtained from a REST API and that is why I am using ember-rest in this example.

If you fix that jsFiddle with your ninja moves, please take a few seconds and explain the concept behind how it works. I found it very difficult to obtain up to date information about this. Thanks!

  • 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-12T07:59:22+00:00Added an answer on June 12, 2026 at 7:59 am

    You connect a view with a controller by using
    a) The appropriate naming scheme
    b) connect the outlets

    For example if you have a view BlockView you should have a controller BlockController. Then from the view you can access the content of the controller directly.

    App.BlockView = Ember.View.extend({
      templateName: 'block'
    });
    
    App.BlockController = Ember.ObjectController.extend({
      block: { name: 'block 1', children: [ {name: 'child1' }, {name: 'child2'}] }
    });
    
    <script type="text/x-handlebars" data-template-name="block" >
       <div>Block Name: {{block.name}}</div>
       {{#each child in block.children}}
         <div>Child Name: {{child.name}}</div>
       {{/each}}
    </script>
    

    What I also miss in your code example is the router. This one takes care of the appropriate ‘glueing’ of all the components. Take a look at the router in Trek’s tutorial (which is btw up to date and represents the way how an application should be written).

    In the router you will define the connectOutlets method in which you load the view that should be rendered into the outlet. And if you stick with the naming scheme from above, you have direct access from your view to the controller

    Update

    I got your code running with some modifications:

    • You don’t need to initiate the controllers on your own. App.initialize() will take care of that for you
    • I modified the resource controller to object controller and removed the resource block but of course this makes no different to ObjectController. Just for basic understanding working with plain ember.js objects makes your life easier.
    • It’s in JavaScript not Coffee Script – sorry for that 😀

    Unfortunately I am not able to create a jsFiddle (don’t ask why – no clue :)). So I have added the data to a GIST – https://gist.github.com/3832764.

    Update 2

    And I also managed to create now a JSFiddle http://jsfiddle.net/qV5wu/2/ 🙂

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

Sidebar

Related Questions

I think I have a problem in understanding the proper way of using MVC.
I think i have a basic problem in understanding the dojo toolkit. Well I
Hi I have a problem in sending data from php to pdf. I think
I am trying to solve this problem http://www.spoj.pl/problems/PEBBMOV/ . I think I have the
I have a problem with understanding how generic constraints work. I think I am
I think I have a problem with casting. $db = mysqli_connect('127.0.0.1','root','password','test'); if (! $db)
I think I have a big problem. I have a two projects solution. First
I think I have a synchronization problem...It may be too basic..Please help.. I have
I have a problem with a template and pointers ( I think ). Below
I have a problem which makes me crazy. I think it is very easy

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.