XXXL Yellow Hanger Chain Print Maxi Rimi Camisole Fancy S Long Printed Dress Dress Ladies Womens Strappy Sleeveless OqWd6gw
Women Combed Hollowed Vintage Poque Sleeve Swing Cocktail Short Bp008 Belle 2 Cotton Dresses Cocktail Belle Poque Hollowed Cotton Women Bp008 Dresses Combed Vintage 2 Short Sleeve Swing

Belle Cocktail Sleeve Dresses 2 Poque Vintage Cotton Hollowed Women Swing Short Combed Bp008 rIgR1r

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