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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:56:03+00:00 2026-06-12T14:56:03+00:00

or else bind controller to two different views. I’m doing this so my ‘home’

  • 0

or else bind controller to two different views.

I’m doing this so my 'home' view gets the PostsController ‘s content.. but I need the real way to do it, if you can help me please!

HomeController: Ember.ArrayController.extend({    
     init: function() {
        setTimeout(function() {
           App.router
             .get('homeController')
               .set('content', App.router.get('postsController').get('content'));
           }, 0);
        }

})

(using last version at this time SHA: 83542a6)

  • 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-12T14:56:04+00:00Added an answer on June 12, 2026 at 2:56 pm

    I don’t quite understand your question. What’s wrong with the solution below? (original jsFiddle here) (updated jsFiddle here)

    (UPDATED: Added skeleton router)

    JavaScript / Ember:

    // Application
    App = Ember.Application.create({
        ApplicationController: Ember.Controller.extend(),
        ApplicationView: Ember.View.extend({
            templateName: "application-view",
        }),
        Router: Ember.Router.extend({
            // initialState of Ember.Router is "root"
            root: Ember.Route.extend({
                // "index" can be called whatever we want
                index: Ember.Route.extend({
                    route: '/',
                    enter: function(router) {
                        console.log("entering root.index from", router.get('currentState.name'));
                    },
                    connectOutlets: function(router) {
                        console.log("entered root.index, fully transitioned to", router.get('currentState.path'));
                        // Demo: read and write from router's connectOutlets
                        console.log("Router says, A:", App.get("aController").get('content'));
                        console.log("Router says, B:", App.get("bController").get('content'));
                        App.get("aController").pushObject({name: "Network switch", color: "beige", type: "Cisco"});
                        console.log("Router says, A:", App.get("aController").get('content'));
                        console.log("Router says, B:", App.get("bController").get('content'));
                    }
                })
                // ... 
                // (add routes here)
                // ...
            })
        })
    });
    
    // Controllers
    App.aController = Ember.ArrayController.create({
        content: [],
        addContact: function(contact) {
            this.content.push(contact);
        }
    });
    
    App.bController = Ember.Object.create({
        contentBinding: "App.aController.content"
    });
    
    // Demo: Change a (shows up in b)
    App.aController.set('content', [
        {name: "Apple", color: "red", type: "fruit"},
        {name: "Banana", color: "yellow", type: "fruit"},
        {name: "Sports car", color: "black", type: "vehicle"},
        {name: "Sun", color: "white", type: "star"},
         ]);
    
    // Demo: Change b (shows up in a)
    (function() {
        var temp = App.aController.get('content');
        temp.push({name: "Linus", color: "n/a", type: "human"});    
        App.bController.set('content', temp);
    })();
    

    HTML / Handlebars:

    <script type="text/x-handlebars" data-template-name="application-view">
    <div id="my-app">
    <h1>aController</h1>
    {{#collection tagName="ul" contentBinding="App.aController.content"}}
        {{#with view.content}}
            Name: {{name}}, Color: {{color}}, Type: {{type}},
        {{/with}}
    {{/collection}}
    <h1>bController</h1>
    {{#collection tagName="ul" contentBinding="App.bController.content"}}
        {{#with view.content}}
            Name: {{name}}, Color: {{color}}, Type: {{type}},
        {{/with}}
    {{/collection}}
    </div>
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone else come across this at all? I used to be able to
Has anyone else had this issue and found a working solution? I've enabled the
has anyone else experienced this . I have SP1 but i have to kill
Has anyone else experienced this? I have uninstalled and reinstalled TortoiseSVN as well as
This is in continuation of two ongoing problems I'm facing: Problems trying to attach
I am trying to bind a promise to a view. I don't know if
How to bind tooltip dynamically for different conditions we have 2 Projects in the
I want to bind the style of button on the basis of if else
I have an item controller which I bind to ObservableCollection<User> . I ran into
This is my code from my controller: MGEntities db = new MGEntities(); [HttpPost] public

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.