s Halo Lena Black Black Sheath Black Black Women Cb Halo ZfaT7nqq
Pleated Big Dress Sleeve Mid Fall Coolred As5 Long Women Pockets Winter Big Fall Long Sleeve Dress Pleated As5 Coolred Women Winter Pockets Mid

Pleated Fall Dress Coolred Mid Sleeve Women Pockets As5 Big Long Winter FqtUZ

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