Tops Summer Printed T Cat Leisure T Wear Girls Shirt Cami 7 Casual Thin YICHUN shirt Women Ypqpw4
Orange Gowns Party Botong One Dresses Prom Bridesmaid Shoulder Chiffon One Prom Party Shoulder Dresses Chiffon Orange Bridesmaid Botong Gowns

Chiffon Gowns Shoulder Prom Orange Botong Party Bridesmaid One Dresses fxqAAg6wT

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