Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to create a "boot" state which all other states much transition through?
    text
    copied!<p>I'm building a simple app with a persistent view. This view is always there. The view depends on some data. Entering the application in a different state should ensure that view is present with it's data. I thought the best way to do this would be to create an initial state which calls <code>connectOulet</code> to connect the data and view. That way all the subsequent states have to transition through this one. I can't figure out how to get the router to automatically transition to the next state after doing the connecting.</p> <p>Here is my router (this doesn't work ATM). See comments.</p> <pre><code>Inbox.Router = Ember.Router.extend enableLogging: true location: "history" initialState: "bootUp" bootUp: Ember.Route.extend root: Ember.Route.extend route: '/' # All states need to transition through this code # How can I transition to root state after this code executes? connectOutlets: (router, context) -&gt; router.get('applicationController').connectOutlet outletName: "list" name: "messages" context: Inbox.store.findAll(Inbox.Message) root: Ember.Route.extend showMessage: Ember.Route.transitionTo('root.showingMessage') initialState: 'dashboard' dashboard: Ember.Route.extend route: '/dashboard' # Entering this state needs the messages view loaded # with data showingMessage: Ember.Route.extend route: '/:id' connectOutlets: (router, context) -&gt; router.get('applicationController').connectOutlet outletName: "details" name: "message" context: context serialize: (router, context) -&gt; id: context.get('id') deserialize: (router, urlParams) -&gt; Inbox.store.find Inbox.Message, urlParams.id </code></pre> <p>Modeling this behavior with a FSM seems correct to me. Is this the correct way to do such a thing or is there a better way?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload