Purple Low Sleeveless Cruiize Mesh Dress Solid Backless Splice Vintage Long Womens Cut wggaTqP1
Gowns With 2018 Formal Lace Evening Blue Jacket Chiffon Dress Mermaid Long DreHouse Women s Formal Evening Chiffon s Lace 2018 With Jacket DreHouse Women Gowns Blue Long Mermaid Dress

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