Olive Appliques Scoop Long Sheer MALL Neck Gold Dresses Prom BRL qCWwzEBcE
Together Mock Made Pullover Tunic Wdr1074 California USA Womens Sleeveless Dress Tie Neck CTC Dye in Come lilac Pullover Dye Made Tie California Mock Wdr1074 USA Neck Dress Together Tunic CTC lilac in Sleeveless Come Womens

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