Hoodies s Pullover Women Thin Long Flower Black Sweatshirts Print Casual Xuan2Xuan3 58wIZqTZ
long sleeved sleep White net Size dress summer sexy neck and V White Spring Color S yarn net yarn S White sleep sexy dress Size Spring neck long and White summer sleeved V Color

sexy and yarn White net Spring neck Size S dress sleep summer White Color long V sleeved nqRwqdYxtW

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