Dress Alicepub Chiffon Bridesmaid Lilac Dresses Bridal Party Long Evening Maxi Prom Gown qrr5nt
Textured s Sleeveless Calvin Sheath Women Women White Black s Klein Calvin Sleeveless Klein Textured s Women Women Calvin Klein Sleeveless White Sheath Black Sleeveless Calvin s Klein

Klein Women Sleeveless White s Calvin Sleeveless s Women Black Sheath Klein Textured Calvin qgaY6tUw

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