Pickle Ladies New Ladies Bodycon Chocolate New Chocolate Pencil Bodycon Strappy Pickle Red Dress Strappy Pencil 0BRwdRx
Design mm Size Strap Poly Canvas Mat 7 Printed Cover x Yoga inch Closure Round Music 28 Zip Bags Shoulder Yoga Poly Mat Bags 28 Zip Canvas Yoga Music mm Yoga Shoulder x Round Design 7 Cover Strap Closure Printed Size inch

inch Mat Design Printed Closure Size Music Poly Bags Canvas 28 7 Strap Cover Zip Round Yoga mm Shoulder Yoga x xq7wtg4tR

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