Chiffon Dance Sexy Belly Astage Blue Sky Dress Sequined Tops daqXaUwxOE
Floral Sleeveless Black Prom Party Allonly Neck Women Low Sexy s Cocktail Deep V High Dress Lace Prom V Party Sexy Allonly Cocktail Deep Neck Lace Floral Dress Black Low Women Sleeveless High s

Black Lace Party Neck Low High Allonly Women Dress Prom Cocktail s V Floral Sleeveless Sexy Deep 8q8fZxUwBR

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