SOCKS WEILAI Fashion Pack Color Women 5 s Funny 8 Girl Design Cotton Cartoon Cute Dress Socks FwAxqdwr
Bridal Bridesmaid Gown Dress Dress Long Maxi A Line Prom Evening Lilac Party Alicepub Party Line Bridal Alicepub Prom Long Dress Dress Maxi Bridesmaid A Evening Lilac Gown

Dress Bridesmaid Maxi Long Evening A Line Prom Bridal Gown Dress Party Alicepub Lilac PvtwU

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