Search code examples
ember.jsember-components

Get an ember component to maintain state across route transitions


In ember controller they maintain state accross transitions as they are singletons, is it possible to do the same thing with a component?

I need this as in my ember app the user navigates around across routes but components in the respective route get initialised to their initial state, I don't want this to happen in this case.


Solution

  • I found that for my use case I need to bind specific fields in the component to either in the controller or the model. It seems components are set to a initial state on each transition.

    eg:

     {{foo-comp  fooCompProp1=fooControllerProp1   fooCompProp2=fooModelProp1 }}