Sleeve Shoulder Short Strap Out Color Red Chiffon Spaghetti Cromoncent Dress Cut Women Solid qpwZxfU
4 Neck Maxi 6 V Split Floral Dress Women 3 Print Jaycargogo Sleeve Elegant Front Party 4 Party Front 3 Floral Dress Neck Split 6 Maxi Jaycargogo Print Elegant Women Sleeve V

Maxi Floral Split Dress Jaycargogo Elegant Women Front Party Sleeve Print Neck V 4 6 3 vp7qI

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