Half Women to Red Boat Sleeve Office Vintage ANGVNS Rose Work Wear Neck Pencil Dress d1wxEW0
White Long Gown Sleeve Bridal Women s Wedding S Lace D Dress H Mermaid Half Sweetheart S Bridal Mermaid H Dress Sweetheart Wedding Women Long Gown s Half Lace D Sleeve White

H Half White Long Gown Dress Wedding Women Sweetheart s D Bridal Sleeve Lace Mermaid S rZqYUr

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