Beauty Pink See Through Train Emily Dress Lace Sweep Evening pRxqpgraw
Dress Swing 8 Casual Sleeve Round Womens Stripe 4 Long Neck Maxi 3 Jaycargogo Jaycargogo 3 Womens Stripe Maxi 8 Casual Neck Dress 4 Round Swing Long Sleeve

Womens 3 Stripe Casual Jaycargogo Long Neck 8 Dress 4 Maxi Round Swing Sleeve gZdAAw

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