Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

InjectPromise #91

Closed
iammerrick opened this issue Dec 21, 2014 · 8 comments
Closed

InjectPromise #91

iammerrick opened this issue Dec 21, 2014 · 8 comments

Comments

@iammerrick
Copy link
Contributor

How does InjectPromise work? Can it be used in tandem with Inject?

@iammerrick
Copy link
Contributor Author

Preferably with ES5 :-)

@caitp
Copy link
Contributor

caitp commented Dec 21, 2014

https://github.com/angular/di.js/blob/master/src/injector.js#L187 << it doesn't look like you can mix synchronous with asynchronous :(

(But admittedly I don't know)

@iammerrick
Copy link
Contributor Author

I was hoping to do something like:

di.annotate(AppHandler, new di.Inject(Navigation),  new di.InjectPromise(SomeAsyncLoadedModelObject));

@iammerrick
Copy link
Contributor Author

Ahh I figured it out. Need two calls to di.annotate.

@iammerrick
Copy link
Contributor Author

No I'm not certain why its useful to use InjectPromise if I can just return a promise call myself?

@iammerrick
Copy link
Contributor Author

It appears that @ProvidePromise also gives it a transient scope instead of making it a singleton?

@tusharmath
Copy link

This module needs some serious documentation

@tusharmath
Copy link

I ended up creating my own module, though heavily inspired by angular,di.

I've removed the concept of providers as it was too verbose. Check it out, and let me know if its useful.

https://www.npmjs.com/package/node-ioc

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants