Off Short Lace Women Homecoming Cocktail Bess Dress s Coral Prom Shoulder Bridal THg6qI
Gown Pink House High Party Low for Belle Beads 2018 Cocktail Women with Dresses 230 Prom Ball High 230 Belle House Ball Pink Dresses Cocktail for Prom 2018 Beads with Low Gown Party Women

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