Package Neck Crew s Hip Women Sexy Dress Sleeveless Vest X6Hxqqnw1I
Spring 04 Long Sexy Dazzle Stretch Dresses Bandage Bodycon Women Party Sleeve L Autumn flash Black DCB006 Warm Women Autumn flash Bandage L Sleeve Dazzle Stretch Black Party Dresses 04 Sexy DCB006 Long Spring Warm Bodycon

Sleeve L Dazzle Autumn flash Long Spring Bodycon DCB006 Sexy Women Black Warm Party Dresses 04 Bandage Stretch aAIgAr

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