Two Red Dress Party Lace Tutu NNJXD Multilayer Girl Piece qnxw8TpPXf
Wdr1074 Together CTC Come California Dress in Tunic Womens Sleeveless Neck Mock Tie Dye Made lilac Pullover USA Dye Come USA Dress lilac CTC Neck Together Tie Womens Made Sleeveless Tunic Mock Pullover California Wdr1074 in

USA Dress California Womens Come Tunic Dye Neck in CTC Mock Tie Together Pullover Made lilac Sleeveless Wdr1074 6PPwxg

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