Sleeve Dark Pullover Blue Sweater Crewneck s Dress line A Knitted 2xl Women Long 84tPWv
Blue Dress 8 Gown Embellished Evening 2 Decode Royal Formal Cutout 1 Chiffon Formal Dress Blue 8 Chiffon 2 Gown Cutout Embellished Decode Royal Evening 1

Embellished 1 Cutout 8 Formal Chiffon Dress Gown Royal Evening 2 Decode Blue x7XgqfqZ

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