33 lines
731 B
Plaintext
Raw Normal View History

2015-04-19 13:53:18 -07:00
2015-04-22 08:06:51 -07:00
p.location-badge.
2015-04-23 08:27:36 -07:00
exported from <a href="/angular2/di_annotations.html">angular2/di_annotations</a>
2015-04-20 13:57:43 -07:00
defined in <a href="https://github.com/angular/angular/tree/master/modules/angular2/src/di/annotations.js#L77">angular2/src/di/annotations.js (line 77)</a>
2015-04-19 13:53:18 -07:00
:markdown
2015-04-23 08:27:36 -07:00
A parameter annotation that marks a dependency as optional. <a href="../di/Injector-class.html"><code>Injector</code></a> provides `null` if the dependency is not
2015-04-20 13:57:43 -07:00
found.
2015-04-19 13:53:18 -07:00
```
class AComponent {
constructor(@Optional() aService:MyService) {
this.aService = aService;
}
}
```
.l-main-section
h2 Members
.l-sub-section
h3 constructor
pre.prettyprint
code.
2015-04-20 13:57:43 -07:00
constructor()
2015-04-19 13:53:18 -07:00
:markdown