46 lines
824 B
Plaintext
46 lines
824 B
Plaintext
|
|
p.location-badge.
|
|
exported from <a href='../di'>angular2/di</a>
|
|
defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.32/modules/angular2/src/di/metadata.ts#L17-L34">angular2/src/di/metadata.ts (line 17)</a>
|
|
|
|
:markdown
|
|
A parameter metadata that marks a dependency as optional. <a href='Injector-class.html'><code>Injector</code></a> provides `null` if
|
|
the dependency is not found.
|
|
|
|
```
|
|
class AComponent {
|
|
constructor(@Optional() aService:MyService) {
|
|
this.aService = aService;
|
|
}
|
|
}
|
|
```
|
|
|
|
|
|
|
|
.l-main-section
|
|
h2 Annotations
|
|
.l-sub-section
|
|
h3.annotation CONST
|
|
pre.prettyprint
|
|
code.
|
|
@CONST()
|
|
|
|
|
|
.l-main-section
|
|
h2 Members
|
|
.l-sub-section
|
|
h3 toString
|
|
|
|
|
|
pre.prettyprint
|
|
code.
|
|
toString()
|
|
|
|
:markdown
|
|
|
|
|
|
|
|
|
|
|
|
|