Neck s Grey Long Bodycon Jaycargogo Plain Sleeve Stretch Midi Women Round Dress 7xU88B
Elegant Jaycargogo 4 Front 6 Print V Sleeve Split Maxi Party 3 Floral Women Neck Dress V 4 Party Women 3 Elegant Floral Front Dress Maxi Neck Split Sleeve 6 Print Jaycargogo

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