Prom 1950s Sweet Print Floral antaina Pink Dress Maxi Midi Vintage Pleated Halter nqpaYpwF
Batik Women Cotton Caftan Beachwear Odishabazaar s Swimsuit 45 Swimwear Maxi Dress Swimwear Odishabazaar Maxi Cotton Women Caftan Dress 45 s Beachwear Batik Swimsuit

s Women Swimsuit Batik Beachwear Odishabazaar Maxi Cotton Dress 45 Caftan Swimwear Hw5dgdqIxX

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