Ruffle Women Baggy Comfy Cotton Dress Style Linen Green s Length Full SF87w68q
Wdr1074 USA Neck Made CTC Tie California in Womens Dress Sleeveless Pullover Together Mock lilac Tunic Dye Come Tie CTC USA Come Dress Together lilac Tunic in Pullover Made Wdr1074 Womens Neck Mock California Dye Sleeveless

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