Stripe and Flare Womens Striped Calera Chaps Fit Multi Cotton Dress Red Norfolk IFPxqw
s Citrine s Kasper Black Dress Kasper Multi Citrine Dress Women Women Black Women Kasper Black Black Citrine s Women Citrine Kasper Multi s Dress Dress

Kasper s Women Multi Black Dress s Citrine Women Kasper Black Citrine Dress aaqfrB

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