Comments (7)
@bellizio
constructor(@Optional() @Inject(RootContainer) rootContainer: | null){ super(rootContainer); }
API can be improved )
from tinystate.
Yes, you can, the container is just a class, it can be Injectable
from tinystate.
@Buggytheclown I tried to, but was unsuccessful.
Here is a code snippet:
You have to call super()
in the constructor since AppContainer extends Container. However, the Container class takes a _rootContainer param of type RootContainer. So I don't know what to pass into the super()
call that would satisfy the _rootContainer param.
What I ended up doing instead was injecting the AppContainer into my service and updating the state from there. Probably a better solution anyway since it keeps the Container clean and simple.
from tinystate.
@bellizio Sorry for the delay. As @Buggytheclown explained, it's totally fine to inject your services or other stuff.
@Buggytheclown do you have an API in mind? I can't think of another solution. Maybe we should document it
from tinystate.
@SebastianM it could be easier to pass Injector itself to super and let RootContainer decide what it want.
constructor(private injector:Injector) { super(injector) }
from tinystate.
@Buggytheclown good idea. I will add that
from tinystate.
@Buggytheclown @SebastianM just to clarify: what should the code look like in my AppContainer's constructor in order to properly call super()
?
from tinystate.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tinystate.