JIANLANPTT Embroidered Party Dresses Purple Tulle Gown Ball Lace Baby Girls Princess Birthday qnq0w4rTO
Ethnic Dress Step Womens Sleeve Off Cromoncent Print One Shoulder 1 Beachwear Long Shoulder Dress 1 Print Cromoncent Step Womens Long One Ethnic Beachwear Sleeve Off

One Cromoncent 1 Beachwear Dress Sleeve Shoulder Step Print Womens Off Long Ethnic rPF0pr

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