Git Product home page Git Product logo

Comments (7)

Buggytheclown avatar Buggytheclown commented on May 29, 2024 1

@bellizio
constructor(@Optional() @Inject(RootContainer) rootContainer: | null){ super(rootContainer); }
API can be improved )

from tinystate.

Buggytheclown avatar Buggytheclown commented on May 29, 2024

Yes, you can, the container is just a class, it can be Injectable

from tinystate.

bellizio avatar bellizio commented on May 29, 2024

@Buggytheclown I tried to, but was unsuccessful.

Here is a code snippet:

screenshot 2018-04-17 11 26 22

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.

sebholstein avatar sebholstein commented on May 29, 2024

@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.

Buggytheclown avatar Buggytheclown commented on May 29, 2024

@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.

sebholstein avatar sebholstein commented on May 29, 2024

@Buggytheclown good idea. I will add that

from tinystate.

bellizio avatar bellizio commented on May 29, 2024

@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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.