Long Evening BessDress Satin The Fomal Party Dresses Dresses Poctets With BD394 Shoulder Off Red ZnRXqwR0
Dress One Blue s Flare Vintage s 1950 Embroidered CharMma Women Shoulder Butterfly Blue Vintage s s CharMma One Dress Women Butterfly Shoulder Flare Embroidered 1950

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