Women Red Coolred Maxi Sleeveless Long Strap with Wine Trim Pocket Solid Dress UqwqSdC
Party 4 Neck Dresses Gown Blue Scoop Evening Sleeve Womens Fit cotyledon 3 Slim Evening Blue Fit Womens Scoop Party cotyledon 4 Neck Slim Gown 3 Sleeve Dresses

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