Camilla Wild Belle Small Wild Tank Back Tank Belle Dress Long Camilla with rwXCrI
Cocktail Low 230 High Belle Party for Women House Prom Pink Gown Beads with Dresses Ball 2018 High House 230 Belle 2018 Beads Gown Party Pink Women Cocktail Dresses Ball for Prom with Low

Pink House Gown Beads Low High Prom Dresses for Cocktail Belle 2018 Ball Women with 230 Party w6qRSnxd1

A constructor parameter decorator that marks a dependency as optional.

See also

Description

The DI framework provides null if the dependency is not found. For example, the following code allows the possibility of a null result:

class Engine {} @ Injectable() class Car { constructor(@ Optional() public engine: Engine) {} } const injector = ReflectiveInjector.resolveAndCreate([Car]); expect(injector.get(Car).engine).toBeNull();
      
      class Engine {}

@Injectable()
class Car {
  constructor(@Optional() public engine: Engine) {}
}

const injector = ReflectiveInjector.resolveAndCreate([Car]);
expect(injector.get(Car).engine).toBeNull();
    

Options