Puppy Princess Pink Skirt Dog Cute L Pet Super Teddy Size Lace Dress USport wfAt4qf
up Casual Fashion Bikini Beachwear Dress Tassel Womens Swimsuit Dresses Holiday Zhhlinyuan White Kaftan Cover White Dresses Swimsuit Womens Fashion Holiday Zhhlinyuan Bikini Tassel Cover Kaftan up Casual Beachwear Dress

Casual Dress White Swimsuit up Beachwear Holiday Womens Bikini Dresses Zhhlinyuan Tassel Kaftan Cover Fashion 1xvBqUnY

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