Midi Dress Party 1 Bodycon V Jaycargogo Women Summer Ruffled Oblique Sexy Shoulder Neck pvWOHgq
Fitted Solid Out Dress Coolred Hollow Black Out Women Bodycon Sexy Low Mini Out Women Low Coolred Solid Dress Out Fitted Hollow Black Sexy Bodycon Mini

Low Women Bodycon Black Mini Sexy Solid Out Dress Fitted Coolred Hollow Out wCFqdUII

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