Ruffled Jewel Soft White Skirt Dress Wedding Organza David Bridal Style s with WG3752 c1w0qwTS7
Off White Pleated Fashion Dress s Line A Lace Sylvestidoso Women Back Sleeveless Floral Party With Little Cocktail Lace Fashion Dress Sylvestidoso Line A Little Party Floral Lace Back Women s Sleeveless With Off White Pleated Cocktail Lace

Back Cocktail Lace Fashion Little Pleated Party White Lace Off s Floral Sylvestidoso With Dress Women A Line Sleeveless Tg8xqFw

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