Top 7Years Pink Princess Kids Outfits Girls 3pcs Skirt Set Necklace Summer 2 Clothes Hx4Rwnqq
Purse Shoulder Ladies Bags Bead Dress Black Womens Pearls Clutch Evening Red Wedding Chain Wallet Bags Bags Clutch Womens Evening Wallet Red Dress Pearls Chain Shoulder Ladies Purse Wedding Bags Black Bead

Dress Black Red Womens Wallet Chain Clutch Shoulder Bags Wedding Bags Purse Pearls Bead Ladies Evening A8q168

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