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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:47:08+00:00 2026-06-11T19:47:08+00:00

I am playing with an Ember-data backed Ember app. The domain language is a

  • 0

I am playing with an Ember-data backed Ember app. The domain language is a bit specific so i will use the terms Gallery and Image for the models. These two are associated: Gallery has many Images.

When I route to a Gallery, The outlet is populated with the galleryView which renders all the images as thumbnails. It also has an outlet where the “selected” image appears full size. This al works great using nested routes.

The crux for me is that I want the index route for a Gallery to show the first image in the gallery by default. I have found this a little tricky to implement.

At routing time the Gallery may not have been fetched from the backend yet. This causes no problems for the gallery itself but I have not managed to make a reference to the yet to be loaded associated Image of the yet to be loaded Gallery.

    connectOutlets: function(router) {
      var controller = router.get('galleryController');
      var context = controller.get('defaultImage');
      controller.connectOutlet('image', context);
    }

defaultImage is where I have been trying to reference an Image I don’t yet know the ID of or have a real reference to. I have so far not bee able to return something form that method that would actually update the view when the data is loaded.

I’ll embarrass myself and show that method too… even though it does not work at all right now.

defaultImage: Ember.computed(function() {
  var image = Ember.Object.create({
    isLoaded: false
  });
  if (this.get('content.isLoaded')) {
    var images = this.get('content.images');
    image = images.objectAt(0);
  }
  return image;
}).property('content.isLoaded')

So, it is listening to the content of the GalleryController and trying to return either an empty object or supposedly the “first” Image in the results.

Should I possibly not even try anything even like that and instead trigger a transition once the gallery is loaded? If so, Id love a hint about where to trigger that transition “safely”. It should only trigger if the gallery index state is reached and not every time a gallery is loaded for example.

I’ll stop rambling now. Please ask me to clarify any part of my question and I’ll update it.

  • 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-11T19:47:09+00:00Added an answer on June 11, 2026 at 7:47 pm

    Assuming that you have one GalleryController and one SelectedImageController you can connect the two using connectControllers. Something like:

    App.GalleryController = Ember.ArrayController.extend({
        content: [],
        selectedImage: null
        // other stuff
    });
    
    App.ImageController = Ember.Controller.extend({
        contentBinding: 'galleryController.selectedImage',
        galleryController: null,
        // other stuff
    });
    

    then in your connectOutlets:

    connectOutlets: function(router) {
        //your other outlets, data fetching etc
        router.get('imageController').connectControllers('gallery');
    }
    

    Now, since the two controllers are bound, you only need to set the App.GalleryController.selectedImage property to the first item in the list. This can be done when App.GalleryController.content is updated.

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

Sidebar

Related Questions

Started playing with Ember.js and ember-data. I followed this tutorial which guides you to
I am playing with Ember and I am trying to use jquery ui sortable.
Playing around with Python - tkInter - Entry widget - when I use validatecommand
Am playing with Google Maps V3 API and StyledMarkers. The data is derived from
I'm playing around with Ember.Router . After going through the excellent sample canonical-emberjs-routing-example by
I've been playing around with Windows 8 code samples - namely the BlogReader app.
Playing with the new(ish) url rewriting functionality for web forms, but I'm running into
Playing with jquery for the first time, and I'm trying to get a simple
Playing with the ssh and public_key application in Erlang, I've discovered a nice feature
Playing around with MongoDB and NoRM in .NET. Thing that confused me - there

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.