New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dependency injection as standalone library #26
Comments
You need to use the DI container to get the instance. import {Container} from 'aurelia-dependency-injection';
var container = new Container(); //your global container for the app, created at startup
var app = container.get(Application); The container has to be used as the source of the instance. |
Thank You. It works like a charm 👯 |
Note, that our next release will make this even better. There's an optional compilation flag for TS 1.5 that enables it to preserve some runtime type information, so we are going to support that metadata in our DI implementation. After the next release, you will be able to do this: import {inject} from 'aurelia-dependency-injection';
import {SampleTest} from 'scripts/SampleTest';
@inject
export class Application {
constructor(simpletest:SampleTest) {
...
}
} |
Hi,
we are writing a library in TypeScript 1.5.
We would like to achieve dependency injection using ES7 proposal decorators.
Instead of writing it ourselves we found your DI component (aurelia-dependency-injection) and tried to use it in our enviroment.
We're faceing some problems. Did you predicted usage of aurelia-dependency-injection without entire aurelia framework?
If so, how can we do it?.. How to create objects without passing arguments to constructor?
index.html
scripts/SampleTest.ts
scripts/Application.ts
The text was updated successfully, but these errors were encountered: