Splice Floral Cocktail s Christmas 6 Dress Basic Gauze Comfy Women qxPgIUYwFW
White A Floral Fashion s Off Women Lace Little Back Sleeveless Pleated Party With Dress Line Cocktail Sylvestidoso Lace Dress Sleeveless s Floral Back Fashion Off Lace Women Cocktail Lace A Sylvestidoso Little With Pleated White Party Line

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