Women Rockabilly Vintage Lila Maggie Dress Tang 1950S Lila Maggie s Dress s Rockabilly Tang Maggie Vintage Women 1950S xXdSwqfXA
Lace Party Grape Sleeves DRESSTELLS Dresses Women Retro s With Cap Swing Dress Bridesmaid Lace Dresses Bridesmaid With Grape Swing Retro Cap DRESSTELLS Party Sleeves Dress s Women

Swing Grape Cap DRESSTELLS With Bridesmaid Women Lace Party Retro Dress Dresses s Sleeves wURqY

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