Gown Size Sleeves Formal Evening Dress Black for Bridal Dora Plus Lace Long Black 4qEPWTxz
Women Plus One Batik African Off Shoulder Loose Underskirts Size Floral Coolred One Loose Shoulder Plus Size Coolred Women Floral African Batik Underskirts Off

Women Plus One Underskirts Off Floral African Shoulder Batik Size Coolred Loose 1dxUq571

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