feat(di): add support for optional dependencies
This commit is contained in:
+18
@@ -58,6 +58,24 @@ export class InjectLazy {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A parameter annotation that marks a dependency as optional.
|
||||
*
|
||||
* ```
|
||||
* class AComponent {
|
||||
* constructor(@Optional() dp:Dependency) {
|
||||
* this.dp = dp;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
export class Optional {
|
||||
@CONST()
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* `DependencyAnnotation` is used by the framework to extend DI.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user