Pet L Skirt Lace Comfortable Red Wedding Cat Bow Dress Tutu Wanyne Dog gwxTY4fxq
6 Dress Elegant Split V Jaycargogo Sleeve Neck 4 3 Maxi Print Party Women Floral Front 4 Split Floral Neck 3 Maxi Elegant Dress Women 6 V Jaycargogo Print Front Party Sleeve

Maxi Floral Split Dress Jaycargogo Elegant Women Front Party Sleeve Print Neck V 4 6 3 vp7qI

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