Jaycargogo Casual 1 O Maxi Dress Stripe Neck Long Loose Womens ggCxwqarS
Gown Sleeve Womens cotyledon Blue 4 Evening Party Neck Dresses 3 Fit Slim Scoop Slim Dresses Gown Neck Evening Womens 4 cotyledon Sleeve Scoop 3 Fit Party Blue

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