Skip to content

Commit c35f1c3

Browse files
Merge pull request #165 from doktordirk/sorted-tests
Split and sorted tests
2 parents f09ff03 + ee08666 commit c35f1c3

6 files changed

+1469
-1428
lines changed

doc/article/en-US/dependency-injection-basics.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ If using TypeScript, keep in mind that `@autoinject` won't allow you to use `Res
331331
* `all(key)`
332332
* `optional(checkParent?)`
333333
* `parent`
334-
* `factory(key, asValue?)`
334+
* `factory(key)`
335335
* `newInstance(asKey?, dynamicDependencies: [any])`
336336

337337
Here's an example of how we might express a dependency on `HttpClient` that we may or may not actually need to use, depending on runtime scenarios:

src/resolvers.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -392,16 +392,16 @@ export function parent(target, key, index) {
392392
/**
393393
* Decorator: Specifies the dependency to create a factory method, that can accept optional arguments
394394
*/
395-
export function factory(keyValue: any, asValue?: any) {
395+
export function factory(keyValue: any) {
396396
return function(target, key, index) {
397397
let inject = getDecoratorDependencies(target);
398-
let factory = Factory.of(keyValue);
399-
inject[index] = asValue ? factory.as(asValue) : factory;
398+
inject[index] = Factory.of(keyValue);
400399
};
401400
}
402401

403402
/**
404-
* Decorator: Specifies the dependency as a new instance
403+
* Decorator: Specifies the dependency as a new instance. Instances can optionally be registered in the container
404+
* under a different key and/or use dynamic dependencies
405405
*/
406406
export function newInstance(asKeyOrTarget?: any, ...dynamicDependencies: any[]) {
407407
let deco = function(asKey?: any) {

0 commit comments

Comments
 (0)