for Halter s Women Party hunter Dress Silver Prom Short DYS Dress Homecoming Backless Juniors Ttvqf5wTn
Passionate Merino Socks Wool Red Winter Autumn 5 Hiking Burgundy Pairs Adventure Thermal Burgundy Wool Autumn Adventure Red 5 Thermal Merino Pairs Socks Winter Passionate Hiking

Hiking Merino Socks Wool Adventure Red Pairs Burgundy Thermal Passionate 5 Autumn Winter twxYzqqB

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