Party Sleeve Wrap Short Dress Jaycargogo White V Womens Floral Boho Maxi Neck Print 88w4Bzq
Evening Lace Neck ANTS Long Dresses s Black Gown Sleeveless Women V Gown Lace Black Neck ANTS Women V Evening s Dresses Sleeveless Long

V Sleeveless Gown Women s Neck Dresses Evening Black Long ANTS Lace zEqIgxOE

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