Mini Lace Shoulder Waist Elastic Ruffle Sexy Cromoncent Womens Off Black Dress IFA6wF84q
1 Casual s Stitch Christmas Dresses Comfy Club Women Printing Gauze Comfy 1 Women Casual s Club Stitch Dresses Christmas Printing Gauze

Club s 1 Stitch Christmas Dresses Printing Casual Women Comfy Gauze wqz450v7xn

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