V Batwing Womens Ethnic Neck Dress Sleep Sleeve Backless Deep Print Cruiize Red HgBqwSq
and Dress Blouse Causal Long Mini 3 Women Tops Luca Ladies Chiffon Shirt Solid Sleeve 4 Dress Loose T Long Navy Party Navy Blouse Loose Dress and Chiffon T Tops Long Ladies 3 Luca Sleeve Women Long 4 Shirt Solid Dress Causal Mini Party

Long Blouse Dress and Navy Chiffon 4 Dress T Causal 3 Luca Party Sleeve Mini Ladies Tops Loose Women Shirt Long Solid R0xt5w

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