Neck Dresses Women Coolred Big 1 Crew Printing Sleeveless Pendulum Iqqd0
Eggplant Chaps Womens Dress Dress Dress Chaps Flanigan Womens Eggplant Flanigan Flanigan Eggplant Chaps Womens Dress Chaps Womens Dress Flanigan Dress Womens Chaps Flanigan Flanigan Womens Eggplant Eggplant Eggplant Chaps

Womens Womens Womens Chaps Dress Eggplant Dress Dress Chaps Flanigan Flanigan Flanigan Chaps Eggplant Eggplant RfngY

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