I have some dependency-free business logic (ES6) classes that I want the 
Injector to make instances off of.

After having these classes imported (via ES6 import statement), how can I 
make them "injectable"?
I'm not able to decorate them with `@Injectable()` because these classes 
must stay dependency-free POJOs.

Here's an example:

```
import { Car, Engine } from 'my-externally-loaded-package';

require('reflect-metadata');  // runs on node.js
let ng = require('angular2/core');  // runs on node.js

// here I'd need to tell angular2-DI that Car needs deps injected

let providers = [
  ng.provide(Engine, { useClass: Engine }),
  ng.provide(Car, { useClass: Car })
];

let injector = ng.Injector.resolveAndCreate(providers);
let car = injector.get(Car);

```

If I decorate the Car class accordingly then of course everything works 
fine. But the mentioned classes must stay dependency-free and not have a 
dependency to a specific framework like angular.


thanks for any help on this :)
 Andreas



-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to