Women Bridal s Bess Ocean Straps Beaded Dresses Spaghetti Chiffon Blue Prom Long nT56x6adqw
Sheath Princess Fire Dress Multi s Seamed 2 Calvin Women Sleeveless Klein Scuba Sheath Multi Princess Calvin Dress Women Scuba Fire Klein 2 Seamed s Sleeveless

Dress Sheath s Fire 2 Princess Women Klein Sleeveless Multi Scuba Calvin Seamed wa8f6

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