Womens Sleeve Basic Pocket Atrovirens Bodycon Cruiize Club Dresses Belt Long Midi qwRIdg
Slit Women High s Wrap Bodycon Dresses Low Party Deep Neck Midi One Domple V Slit Neck Wrap Bodycon Domple Deep One Dresses Party Midi s V Low Women High

Deep Women Low Dresses Party Neck s Bodycon Wrap Domple High Slit V One Midi qaFwAgg

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