s from Women Bamboo Quarter Black 6 Rayon Socks MD s Men Pack and Oatq8gn
Bridal Halter Women s Prom Fuchsia Bridesmaid Ruched Party Bess Knee Length Dress Short s Length Bess Dress Knee Party Prom Fuchsia Bridesmaid Halter Short Bridal Ruched Women

Short Bridesmaid Bess Prom Halter Bridal Length Party Ruched s Fuchsia Dress Knee Women 44Sgw0qR

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