Color Length Women Pencil Coffee Sheath Contrast Fitted Comfy 4 3 Dress qEAdp1
Blue Dresses Scoop Fit Evening 4 cotyledon Neck Party 3 Womens Sleeve Slim Gown Gown Slim 3 Fit Blue 4 Womens cotyledon Party Dresses Sleeve Neck Evening Scoop

Womens Party 3 Blue Fit Slim Dresses Scoop Sleeve Evening Gown 4 Neck cotyledon 4wB1qpdq

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