Stretch Long Sleeveless Vogue Dresses Splice Women Printing Red Strappy Cromoncent 7Y0qX
Klein Calvin Klein s Women Calvin Textured White Sheath Black Sleeveless s Women Sleeveless Sleeveless Black s s Sleeveless Women Sheath Women Calvin Textured Klein Klein White Calvin

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