AK Bridesmaid Beauty Dresses Women Long AK Long s Chiffon Women Burgundy Bridesmaid Chiffon Beauty s SxqXwdX
Neck Dress Cocktail Prom V Women Low Lace Sleeveless Sexy Floral High s Deep Black Allonly Party V Dress Neck High Lace Floral Women Prom Low Sexy Party Black Deep Cocktail s Sleeveless Allonly

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