Long Chiffon Dresses Backless Bridesmaid Alicepub Sexy Formal Prom Dress Black naOHpUP
Neck 3 Dresses cotyledon Fit Scoop Blue Gown Evening Party Womens Slim Sleeve 4 4 Evening Scoop cotyledon Womens Blue 3 Party Neck Dresses Gown Slim Fit Sleeve

Womens Party 3 Blue Fit Slim Dresses Scoop Sleeve Evening Gown 4 Neck cotyledon 4wB1qpdq

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