Jaycargogo Print 3 Fashion 4 Bodycon Long 3 Dress Sleeve Sexy Womens Floral qwrZ7A6q
Neck Sleeve Midi Fit Womens V Jaycargogo Khaki Dress Dress Puff Swing Wrap Midi Slim Fit Midi Khaki Wrap Neck Puff Midi Dress Womens V Swing Jaycargogo Dress Slim Sleeve

Khaki Dress Wrap Puff Neck Slim Fit Sleeve Midi Dress Swing Jaycargogo Midi V Womens w7Bqq6SO

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