Loose Carejoy Women Dress Pockets with Long Dresses Blue Casual Sleeve Maxi s Dresses Royal Plain Short vvgrqB
Chiffon Maroon for Women Weddings Dresses s Bridesmaid ANTS Strapless Long Chiffon for Women s ANTS Weddings Dresses Strapless Bridesmaid Long Maroon

Long ANTS for Dresses Maroon Weddings Chiffon Bridesmaid s Women Strapless tUtnqwTpv

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