Bridesmaid s Blue Prom Women Chiffon Evening Navy Dress Spaghetti Bess Long Straps Bridal 76nEqxp
Gown Chiffon Dress Straps Homecoming Women s Black Anlin Short Bridesmaid Evening Prom Straps Gown Women Short Anlin Prom Chiffon Black Dress Homecoming s Evening Bridesmaid

Gown Short Women Black Anlin Homecoming Prom Chiffon Evening Bridesmaid Straps s Dress avd7x

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