V Formal Open s Bess Black Party Lace Back Dress Chiffon Neck Bridal Evening Women XExxwztR
Evening Chiffon Long Gowns Mother Formal Prom Of Dresses Wedding Silver The Bride Cdress Cdress The Prom Mother Gowns Formal Wedding Long Chiffon Evening Of Bride Silver Dresses

Long Bride Wedding Of Formal The Silver Evening Gowns Prom Mother Dresses Chiffon Cdress nAq6aB6

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