Evening Gowns BHS058 Homecoming Lace Beaded Light Purple Dresses Women BessWedding Strap Spaghetti pRx0zH
Calla Dress Neck Halter Ball 3XL XS Quinceanera Collection Champagne Womens Dress Calla Quinceanera Neck Halter 3XL Ball XS Champagne Collection Womens

Halter Ball Quinceanera XS Calla Collection Womens Champagne Neck 3XL Dress 1nWwwtAFUq

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