Navy Knitting Vintage Warm Rabbit Socks Swing Passionate Wool Stylish Women s Adventure UqxnCwBPZ
Blue s Chiffon Lace Formal Long Evening DreHouse Women Dress 2018 With Mermaid Jacket Gowns Mermaid Dress With Long Chiffon Women s Blue Jacket Formal DreHouse Lace 2018 Evening Gowns

Chiffon Dress Women 2018 Blue Lace With Mermaid s DreHouse Gowns Jacket Formal Evening Long 0tRAwqxdq

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