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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:54:51+00:00 2026-06-13T15:54:51+00:00

I got problem with initialization of application. I create jsfiddle which simply works on

  • 0

I got problem with initialization of application.
I create jsfiddle which simply works on my desktop but not on jsfiddle.

http://jsfiddle.net/zDSnm/

I hope you will catch the idea.

On the beginining od my aplication I have to get some values from rest and values to Ember.Select.
Depends on what is choosen all my connectOutlets functions use this value.

Here I get some data from REST

$.ajax({
  url: 'https://api.github.com/repos/emberjs/ember.js/contributors',
  dataType: 'jsonp',
  context: this,
  success: function(response){
    [{login: 'a'},{login: 'b'}].forEach(function(c){
        this.allContributors.addObject(App.Contributor.create(c))
    },this);
  }
})

and put it to my Select View:

{{view Ember.Select
contentBinding="App.Contributor.allContributors"
selectionBinding="App.Contributor.selectedContributor"
    optionLabelPath="content.login"
optionValuePath="content.id" }} 
{{outlet}}

And in every of my route I need to use this value, which is selected in this selection box

index : Ember.Route.extend({
    route: '/',
    connectOutlets: function(router){
        router.get('applicationController').connectOutlet('oneContributor',App.Contributor.selectedContributor);
    }
})

I’d also add observer to this selectedContributor value which calls connectOutlets of currentState (I know I shouldn’t do this but I don’t know why and how should I do this in properly way)

App.Contributor.reopenClass({
    //...
refresh : function(){
    App.router.currentState.connectOutlets(App.router);
}.observes('selectedContributor'), 
    //...

I hope there is some good way to solve such problem.
If there is something not clear please leave comment.

  • 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-13T15:54:52+00:00Added an answer on June 13, 2026 at 3:54 pm

    If I understand correctly you want to show the currently selected contributor. One way to do it is to listen for a change in the selected contributor and send a transitionTo action to the Router.

    First the router:

       index : Ember.Route.extend({
            route: '/',
    
            showContibutor: Ember.Route.transitionTo('show'),
            showNoneSelected: Ember.Route.transitionTo('noneSelected'),
    
            connectOutlets: function(router){
              router.applicationController.connectOutlet({ name: 'contributors', context: App.Contributor.find() });
            },
    
            // if no contributor is selected, the router navigates here
            // for example, when a default option "Make a selection" is selected.
            noneSelected: Ember.Route.extend({
               route: '/'
            }),
    
            show: Ember.Route.extend({
               route: '/:contributor_id'
                 connectOutlets: function(router, context){
                 router.applicationController.connectOutlet({name: 'contributor', context: context})
               },
    
               exit: function(router) {
                 // This will remove the App.ContributorView from the template. 
                 router.applicationController.disconnectOutlet('view');
               }
            })
        })
    

    with a template for App.ContributorsView:

    {{view Ember.Select
      contentBinding="controller"
      selectionBinding="controller.selectedContributor"
      optionLabelPath="content.login"
      optionValuePath="content.id"}} 
    
    {{outlet}}
    

    and an ArrayController to manage contributors:

    App.ContributorsController = Ember.ArrayController.extend({
      onSelectedContributorChange: function() {
         var selectedContributor = this.get('selectedContributor');
         if (selectedContributor) {
           App.router.send('showContributor', selectedContributor);
         } else {
           App.router.send('showNoneSelected');
         }
      }.observes('selectedContributor')
    });
    

    The user a selects a contributor and the contributorsController tells the router to show the view for the contributor (i.e, show the view App.ContributorView with context selectedContributor).

    App.ContributorView = Ember.View.extend({
      templateName: 'contributor'
    });
    

    controller for selected contributor:

    App.ContributorController = Ember.ObjectController.extend({
      // define events and data manipulation methods
      // specific to the currently selected contributor.
    });
    

    Hope this helps.


    UPDATE: If you need to show the first record by default, the noneSelected route should look like this:

            noneSelected: Ember.Route.extend({
               route: '/',
               connectOutlets: function(router){
                 var context = router.contributorsController.get('content.firstRecord');
                 router.applicationController.connectOutlet({name: 'contributor', context: context})
               }
            })
    

    And define firstRecord in ContributorsController:

    App.ContributorsController = Ember.ArrayController.extend({
      firstRecord: function() {
        return this.get('content') && this.get('content').objectAt(0)
      }.property('content.[]')
    });
    

    Haven’t tested it, but it should work.

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

Sidebar

Related Questions

I've got another problem in the same code... I'm getting this error: initialization method
I've got problem for my application. I want to start connectbot from my application
have a nice day. I got problem when trying to create an image from
Previously, I have worked on local notifications, but I got problem in it now.
I've got a problem trying to create a custom tableview cell for my iPhone
I got problem about play wav file in my application. This is my error:
I'm considering using Spring to assemble the components of my application, but I've got
I got problem with Doctrine. I add this lines in my application.ini: includePaths.model =
i got problem with my code and hopefully someone able to figure it out.
I got problem with sending data in Android using httpPost. I found some example,

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.