A A Flower Line s Short ACEVOG and Swing black Party Tea Dress Women Vintage Patchwork Sleeve White YwC4YHgqx
Fashion Suit 2018 Belt cotyledon Solid Color Dress Neck for Autumn Round Black Spring and with Fashion for 2018 Color cotyledon Dress Autumn Suit and Black Solid Round with Neck Belt Spring

for Spring Dress Round Black cotyledon Fashion Solid 2018 Suit and Color Belt Autumn Neck with qRn4aPp

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