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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:55:03+00:00 2026-06-17T15:55:03+00:00

Say I have a list of Action objects, which corresponds to a Ember model.

  • 0

Say I have a list of Action objects, which corresponds to a Ember model. Each has a few properties (timestamps) and a detail attribute, which can can recursively contain more details (arbitrarily deep nesting). You can think of the details as nested lists.

I want to write a UI that allows easy editing (auto completion of values, easy copy and paste, reorder elements, etc) of the detail for any Action object.

Right now, my DetailView template will recursively render additional DetailViews:

{{#if view.content.hasChildren}}
    {{#each child in view.content.children}}
       {{#DetailView contentBinding=child}}
    {{/each}}
{{#else}}
    {{#EditDetailView contentBinding=view.content.value}}
{{/if}}

So each DetailsView corresponds to a node in the Details object tree.

But I am unclear how to add controllers to the mix — there is additional state I need to store / functionality to implement (e.g., transforming values from the Detail object for display in the DetailsView; handling events for inserting/deleting/reordering elements; changing the structure of the Details tree) that belongs neither in the model nor the view.

Ideally I would have a DetailsController serving as a proxy a Details per DetailsView. Can I dynamically instantiate controllers and set up their contents within a view template? My understanding of the new Ember Router is to setup controllers and outlets in in a given route; however, that doesn’t seem to apply here because no routing is being done at all. All suggestions / insight about how to handle recursive controllers / views / routes welcome.

I’ve taken a look at EmberJS Nested Views and Controllers, but that proposes I have a single ArrayController for all Details, even across Actions … this would not preserve the tree structure of the nested details either.

I’ve also looked at Recursive view in handlebars template not working after upgrading to Ember 0.9.6 but the solution doesn’t say anything about controllers.

  • 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-17T15:55:04+00:00Added an answer on June 17, 2026 at 3:55 pm

    ** UPDATE Feb 20, 2013 **

    API documentation for the {{control}} helper is now available here. It warns that “The control helper is currently under development and is considered experimental.”

    To enable it, set ENV.EXPERIMENTAL_CONTROL_HELPER = true before requiring Ember.

    ** UPDATE Feb 3, 2013 **

    A new helper {{control}} has been added to ember, implementing the Reusable Views proposal. So to have a DetailsController proxy a Details per DetailsView you can just:

    {{control 'detail' child}}
    

    See the {{control}} tests for example


    Ideally I would have a DetailsController serving as a proxy a Details per DetailsView. Can I dynamically instantiate controllers and set up their contents within a view template?

    Typically the way to do this would be via the handlebars {{render}} helper, which renders a template with an appropriate view and controller. Unfortunately you cannot use {{render}} to insert the same template more than once, so it cannot be used within an {{each}} block.

    There was a lengthy discussion on the topic recently. See: Non-Singleton Controller Discussion!

    Two solutions were proposed. The first involves adding an itemControllerClass property to ArrayController. If this property was set, the ArrayController would automatically wrap new contents in the specified class. This was added to ember a few weeks ago and takes care of most use cases, where you have a flat-list of items and want each to be wrapped in a proxy.

    The second proposal, Reusable Views, allows you to provide a controller class to a view.

    {{view UI.Calendar dateBinding="post.startDate" controllerClass="App.CalendarController"}}
    

    This would create an instance of App.CalendarController for each UI.Calendar widget, which would be tied to the lifecycle of the widget. As of today this has not been implemented. See {{view}} should have an option to create a controller! for the latest status.

    So AFAIK there is not a good way to accomplish this for the use case you outlined. Meantime, binding data to the view:

    {{view App.DetailView contentBinding="child"}}
    

    and then having some logic in the view itself seems reasonable. If/when Reusable View support is added to master you can pull that logic up into the controller.

    See: https://github.com/emberjs/ember.js/issues/1766

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

Sidebar

Related Questions

Say I have a list of member, each of which is a custom object:
Say I have a list of items from a database. Next to each item
Say I have a list x with unkown length from which I want to
Say I have an array of objects similar to [ {name:value1, action:U}, {name:text2, action:d}
Say I have a list of integers: List<int> myInts = new List<int>() {1,2,3,5,8,13,21}; I
Say I have a List like: List<String> list = new ArrayList<>(); list.add(a); list.add(h); list.add(f);
Say we have a list of integers from 0 to 1000: [0, 1, 2,
Say I have a list of arguments: > (setf format-args `(t it's ~a 1))
Say I have a list containing strings that look like this: 00x000s00g00wfds0d dkdf00sdf00sdfg00jk kf00dfjkd0sdl0sd0f0
say I have a list of names var names = new List<string>{Tom, Dick, Harry};

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.