Neck David OC290027 Black Bridal Length Tea V Mikado s Style Dress Bridesmaid Rqqt1w
Coolred Midi Pullover 1 Painting Short Dress and Digital Midi Maxi Loose Women Printed Sleeve Skirt Summer Summer Painting Women Pullover Skirt and 1 Summer Dress Midi Midi Summer Coolred Printed Loose Short Maxi Sleeve Digital

and 1 Digital Loose Maxi Short Midi Printed Coolred Women Summer Skirt Midi Sleeve Pullover Dress Painting Summer aqYPaxSTg

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