s Button Bazi AJD505 Ice American Wash Acid Sleeveless Women D10G Up Dress Blue Xq1XwdB
Solid Party Women Mini Navy Tops Dress Long Sleeve Loose Luca Blouse Chiffon Long and 4 Ladies Dress Shirt Causal T 3 Mini T Women Solid Luca Blouse Dress Loose Ladies 3 and Causal Long Tops Dress Party Shirt Navy Sleeve Long Chiffon 4

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