Cute Cute Christmas Dog Color15 Puppy Present Tag Necklace Puppy Keychain qaFd5gwxa
Apple Bridal Back David Bridesmaid Chiffon Jumpsuit Style Dress Crinkle Tie Bridesmaid s F19741 Style Chiffon Back Bridesmaid Jumpsuit David Tie Bridal Dress Bridesmaid s Crinkle F19741 Apple

Style David Apple Jumpsuit Crinkle s Bridesmaid Tie Dress Bridal F19741 Chiffon Back Bridesmaid qTvUpHq

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