Hi 4 Lo 3 Purple of Bride Formal Gown Women MACloth V The Dress Neck Mother Sleeves apxwFB8q
Coolred Office Belt Waist Women Empire Floral Yellow Dress Waist Neckline Boat Belt Boat Waist Floral Office Dress Waist Neckline Women Yellow Empire Coolred

Yellow Dress Boat Women Coolred Waist Belt Floral Waist Empire Neckline Office vZq44x6w

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