Dress Women V 1 Sleeveless Deep Jaycargogo Maxi Asymmetrical Neck Floral s Summer vSqwntd
Party 3 6 Split Front Elegant Maxi Women Neck Sleeve 4 Dress Print Floral Jaycargogo V Neck Women 4 3 Front Jaycargogo Dress Print V Elegant Floral Sleeve Party 6 Maxi Split

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