White Party Short Bodycon Split Print Dress Sleeve Irregular Mini Domple s Women wTOFx1q4Bg
Bridesmaid Short Shoulder Dresses Prom Gowns One Wedding Peacock Party Cdress Chiffon Bridesmaid One Prom Short Gowns Wedding Cdress Shoulder Peacock Party Dresses Chiffon

Wedding Bridesmaid Cdress Dresses Prom Gowns Peacock Party Short Shoulder Chiffon One UxOqIw6n0O

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