Dresses Short Homecoming Party Grape V Dresses Beads Double Formal Satin BD343 BessDress Neck RvOwq
Shoulder Dress Party Sexy Color Evening One Word Women Pure Coolred Black Flounced Dress Flounced Party Color Sexy Black One Word Evening Coolred Women Shoulder Pure

One Evening Sexy Pure Black Coolred Flounced Dress Color Party Women Word Shoulder Z7XznxqBTW

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