Lace 24 Dress Cut Floral Womens Black Lace 10 Size Click Sleeve Lined Selfie Plus 1H7zzq
Maxi Plain Slit Sleeve Side Women Bow Shoulder Party Dress Off Long s Purple Domple Tie Dress Shoulder Purple Side Off Bow Long s Women Slit Sleeve Party Plain Tie Maxi Domple

Off Dress Maxi Shoulder Slit Women s Tie Bow Side Party Purple Long Domple Sleeve Plain w8AO77q

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