Long Sleeve S Dress Tag Down US Collar S Red Button Loose Asymmetrical Stand Women Hem Shirt wtnZqv1IxT
Women Swimwear Swimsuit Maxi Cotton Beachwear Odishabazaar 45 Caftan Dress Batik s Cotton Women Caftan Beachwear Dress Maxi 45 Swimwear Odishabazaar s Swimsuit Batik

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