Long Chiffon Women Lace Navy Bess s Gowns Bridesmaid Prom Dress Bridal Evening qaFSwxA
Long 12 Size Plus Front New Click Sleeve Ladies Dress Wrap Charcoal Jersey Over Selfie Swing Skater 18 New 18 Size Dress Plus Long Selfie Wrap Front Ladies Skater 12 Charcoal Sleeve Over Swing Click Jersey

18 Dress Ladies Over Sleeve Front Selfie Long 12 Plus Click Charcoal Swing Jersey New Skater Wrap Size FWAqwZ

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