s 1 Maxi Dress Embroidered Jaycargogo Dress Lace Vintage Cocktail Women q75Cp
Short Bridal Royal Blue Beauty Party Sweetheart Dress Tulle Evening Homecoming Womens Gowns Blue Beauty Bridal Evening Tulle Homecoming Royal Short Gowns Dress Party Womens Sweetheart

Evening Sweetheart Dress Tulle Womens Blue Beauty Royal Bridal Gowns Party Short Homecoming q78xEwtpwH

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