18 lines
549 B
Plaintext
18 lines
549 B
Plaintext
|
|
p.location-badge.
|
|
exported from <a href='../di'>angular2/di</a>
|
|
defined in <a href="https://github.com/angular/angular/tree/master/modules/angular2/src/di/annotations_impl.ts#L54-L72">angular2/src/di/annotations_impl.ts (line 54)</a>
|
|
|
|
:markdown
|
|
A parameter annotation 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;
|
|
}
|
|
}
|
|
```
|
|
|