Evening Cocktail Dress navel Dew Maxi Neck Women Gowns Formal Sexy Halter Dresses vqw8nRO
Short Mini s Meo Collective Gathered Dress Sleeve Detail Ruffle Less Shell No Women C Shell s No Dress Short Collective Ruffle C Detail Sleeve Meo Less Women Mini Gathered

Ruffle Detail Meo Gathered Short Dress Mini Sleeve Less C No s Women Shell Collective 8zw1qTB

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