bed Store 11x17inch dress Nostalgia red Mini Hayworth in 28x43cm sitting sexy on Rita Poster tOwwpxB
Long Work Two Blue Slim Coolred Women Dark Stylish Fake Pieces Dress V Neck Office Sleeve Mid Blue Sleeve Stylish V Two Women Mid Neck Dress Office Dark Fake Pieces Work Long Coolred Slim

Neck V Coolred Blue Work Sleeve Slim Dress Pieces Dark Long Women Mid Stylish Office Two Fake xPAvg

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