V Knit SYGoodBUY Bodycon Dress Lace Strapless Woman Short Dress Pink up Bodycon Neck 123 qzawtKda
Bodycon Party Neck Deep s Domple Low Women One V Midi Dresses Wrap High Slit High Wrap Midi Neck Dresses Domple Women Deep s Bodycon Slit V One Party Low

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