Cocktail Women Black Plus Sleeveless Silk Dress Maxi Vintage Size Summer DISSA S2995 XqwSwf
Fire Sheath Calvin Women Dress Klein Scuba s Princess Multi 2 Seamed Sleeveless Women Sheath 2 Multi Princess Dress Sleeveless s Scuba Klein Calvin Seamed Fire

Dress Sheath s Fire 2 Princess Women Klein Sleeveless Multi Scuba Calvin Seamed wa8f6

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