Dress Dress Summer Sleeveless Fractal Story D Sundress Women Women qSZRR8
Calvin Pleated 6P Peach Dress Women Orange Sheath s Petite Klein Dress Petite s Pleated 6P Klein Women Peach Calvin Sheath Orange

Women Sheath Pleated Dress Petite Peach Calvin Orange Klein 6P s YPqxX46E6w

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