Bride Purple Vintage Women of Sleeve Lace Dress Party Short MACloth Wedding Mother Cap 8FBnx
Star 4th As One Women July Picture Cozy Summer Fit Stretchy Patriotic Step Beachwear Dress Coolred Silm Sexy Sleeveless Mid Silm Sleeveless Beachwear Star Step Cozy Sexy 4th Coolred Stretchy One Women Patriotic July Summer Picture Mid As Dress Fit

Coolred Star Picture Stretchy Cozy Summer Sexy Patriotic Beachwear Fit Dress 4th As One Silm Sleeveless Step Mid Women July rpqIUr

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