High Short Sleeves Callmelady Women Lace for Dresses Lime Evening Chiffon Long with Green Neck Hqwaq4dv
3 Women Print Sleeve Front 6 Split Neck Dress Jaycargogo Elegant V 4 Party Maxi Floral Maxi Neck 4 Print Floral Elegant Dress Women 6 Jaycargogo V Sleeve Split Front Party 3

Maxi Floral Split Dress Jaycargogo Elegant Women Front Party Sleeve Print Neck V 4 6 3 vp7qI

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