Park Tag Dog Alley Necklace Keychain Color29 Snowy Bench Trees 56W4p
Sexy Dress Beachwear Step Sleeveless As Fit Summer Star Mid Women One Coolred 4th Patriotic Cozy July Silm Stretchy Picture Fit Women 4th Beachwear Picture Cozy Mid July Stretchy Patriotic Sleeveless One As Step Sexy Star Coolred Summer Silm Dress

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