How to reuse mixin instance which is already created?


#1

I include a mixin into a route and component, it creates two different instances but I wanna use the same instance which is created in the route since I update some values over there which are needed to the component. Is this possible?


#2

I think that what you are looking for are services.


#3

Of course, similar to services. Services will be useful if I wanna maintain the state permanently. But I need to maintain some of the properties’ state for few moments. So that I raised a question for a better solution to satisfy my scenario.


#4

I don’t think that you can do that with mixins (someone corrects me if I’m wrong). If your mixin isn’t too complex, maybe creating an Ember.Object in your route and sharing it with the component could be enough for your case.

Maybe you can give us more details about your case. Usually you raise up your actions so the route/controller handles what it’s needed to do with the data provided to the component, have you considered this?


#5

@Henry tons of thanks . Got an alternative idea by your suggestion!