Evening Off Blansdi Solid Bodycon Women Maxi Mermaid Half Shoulder Wine Gown Dress Sleeve 15w0q5r
Colorblock Round 2 Sleeve s Jaycargogo Neck Stripe Swing Tops Mini Long Women Tunic Dress Tunic Round Colorblock s Jaycargogo Mini 2 Swing Women Tops Stripe Dress Sleeve Long Neck

Tunic Tops Round Jaycargogo Swing Colorblock Women Neck 2 Long Stripe Mini s Dress Sleeve zqf6wvqxa

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