Beaded Gowns Dresses Ivory Short Lace Piece BD335 Ball Two Homecoming Short BessDress Party pvfZUn5
Orange Klein 6P Petite Calvin Dress Sheath s Peach Pleated Women Women 6P Pleated Dress s Peach Orange Petite Calvin Sheath Klein

Women Sheath Pleated Dress Petite Peach Calvin Orange Klein 6P s YPqxX46E6w

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