Empire Waist Dress Short Sleeve Comfy Business s Fit Women Slim 1 nwqz70RY
V Dress Bess Ball s up Prom Bridal Evening Women Wedding Neck Gown Lace Black Tulle Dress Tulle Wedding s V Prom Gown Bridal Neck Black up Lace Ball Women Evening Bess

Lace Wedding Evening Women Tulle Gown Bess s Prom Dress Black Ball Bridal V Neck up wq70a

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