Plus Underskirts Batik Coolred Size Shoulder Floral African One Women Loose Off S5qw4x1F
Sweater 010 Sport Floral Short Pull Sweatshirt T Thin Women Sweat Hoodie Hooded Blouse YICHUN Jumper Top Shirt Girl Floral Sweater Top Girl Jumper Sport Hooded T Sweat YICHUN Women Hoodie Shirt Short Blouse Sweatshirt Thin 010 Pull

Thin Sweatshirt T Pull Short Girl YICHUN Sport Sweat Floral Hoodie Women Blouse Sweater Jumper Hooded 010 Top Shirt WnSYHZx

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