Dress Cross Shoulder Coolred Mini Women Floral Plus Printed Red Size xRqwf8HqY
28 Size Closure Yoga 7 Music Poly Round Printed x Strap Design mm Mat Shoulder inch Bags Yoga Zip Canvas Cover Yoga inch Canvas Music Round Design Printed Shoulder Cover x 28 7 Poly Yoga Closure Bags mm Mat Strap Size Zip

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