Comfy Package Solid Hip Dress Slit Khaki Side Pencil Zipper Open Back Womens rYq0HwUr
s Dress Women 1950 Butterfly Blue Flare Embroidered Vintage CharMma s Shoulder One Women Flare s CharMma Butterfly Shoulder Blue Embroidered Dress 1950 Vintage s One

CharMma s Dress 1950 Butterfly Flare s Embroidered Women Blue Shoulder One Vintage rRxTrfqw

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