Purple LF abaya Clothing 17 Women long Islamic dress dubai muslim Embroidery Jalabiya wPzTnTX1q
C Sleeve Detail Mini Women Shell Gathered Short Dress Less s Ruffle No Meo Collective Sleeve Collective Gathered Detail Less No C Short Meo Dress Women Shell Ruffle s Mini

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