2015-07-27 22:12:30 -07:00
p.location-badge.
exported from <a href='../di'>angular2/di</a>
2015-08-02 23:08:36 -07:00
defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.33/modules/angular2/src/di/metadata.ts#L17-L34">angular2/src/di/metadata.ts (line 17)</a>
2015-07-27 22:12:30 -07:00
: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;
}
}
```
2015-07-28 13:28:47 -07:00
.l-main-section
h2 Annotations
.l-sub-section
h3.annotation CONST
pre.prettyprint
code.
@CONST()
2015-07-27 22:12:30 -07:00
.l-main-section
h2 Members
.l-sub-section
h3 toString
pre.prettyprint
code.
toString()
:markdown