s Women Bodycon 3 Sexy Jaycargogo Midi V Pleat Solid Neck Black 4 Sleeve Dress d5wqxExrvI
Sleeve V s Women Elegant blue YMING Neck Tunic Vintage Half Navy Dress Deep Swing Cocktail Navy Sleeve Elegant Cocktail blue Women Dress YMING Deep Swing V Half Tunic Neck Vintage s

Navy Swing blue Neck Tunic Cocktail s YMING Dress Women Deep Half Sleeve Elegant V Vintage WOPwq06

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