Does it make sense to want to inject something into a mixin

Hi all,

So I’m using ember-cli and I want to use a util object of mine. I was trying to inject said object into the mixin in an initialiser. But then I realised that you have to call create on mixins as oppoSed to extend.

This means that ember isn’t instantiating the object and therefor won’t inject anything into it.

This got me thinking if two things? How would I go about injecting something in to a mixin?

But before that, should I even be attempting this? The fact it’s difficult makes me think that maybe I shouldn’t be doing it. The idea it want to inject makes sense to me but thinking maybe I need to look at a different approach.

Thoughts?

You could use a servicelocator style resolution. This is quite frowned upon in other languages / frameworks though.

What is it you’re trying to achieve exactly, why and what do you want to inject into a mixin?

You can instantiate it and register it within your initializer.