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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:25:00+00:00 2026-06-04T09:25:00+00:00

When using Ember.StateManager, the most common transition between Em.States involve some parameter or another.

  • 0

When using Ember.StateManager, the most common transition between Em.States involve some parameter or another. Currently, I am using instance variables within the StateManager to pass parameters between States, when I do go from one state to another using goToState. This seems incredibly ugly to me. Is there a reason there is not a more standard way of passing parameters? Or should I use a different pattern.

For example,

App.stateManager = Em.StateManager.create({
  initialState: 'listContacts',
  listContacts: Em.ViewState.create({
    ...
    actionSelectContact: function(manager, context) {
      manager.set('selectedContact', context);
      manager.goToState('showContact');
    }
  }),
  showContact: Em.ViewState.create({
    enter: function(manager, transition) {
      var contactToShow = manager.get('selectedContact');
      ...
    }
    ...
  })
})

Is there a better way to do this parameter passing between states?

  • 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-04T09:25:01+00:00Added an answer on June 4, 2026 at 9:25 am

    Tom Dale just added a transitionTo method to deal with this. transitionTo takes a context object along with the name of the target state. Now within your action you could do something like,

    viewStates = Ember.StateManager.create({
      showingPeople: Ember.ViewState.create({
        view: ContactListView
      }),
    
      showDetailAction: function(mgr, selectedPerson) {
        mgr.transitionTo('showingPersonDetail', selectedPerson);
      },
    
      showingPersonDetail: Ember.ViewState.create({
        setupContext: function(manager, context) {
          this.set('person', context);
        },
        view: PersonDetailView
      })
    })
    

    You could also get more fancier and pass parameters for multiple states along the way like,

    stateManager.transitionTo(['planters', { company: true }], ['nuts', { product: true }]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using ember-data, currently I'm loading data into the controller, on page load, as follows:
Edit: found the answer here: Using Ember.js, how do I run some JS after
Possible Duplicate: Using Ember.js, how do I run some js after a view is
I am working on converting a Backbone application into an Ember application using Ember
I'm using http://cloud.github.com/downloads/emberjs/ember.js/ember-0.9.5.js and I'm not sure how to use the mouseenter and mouseleave
I want to embed some youtube videos at my site using Video.Flash helper. Microsoft.Web.Helpers
I am using python's very high level layer to embed some python code to
I can include an array in an Ember object, and display the contents using
I am struggling to get a list created by Ember.js sortable using jQuery.ui. The
Using Ember.js I get an endless loop with the following code: Controller: App.activityDetailsController =

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.