Sleeveless Prom Beauty Dresses Crew AK Evening s Neck Women Navy x0UxqXw
2 Dress Color Dresses 4 Sleeve 3 Women Neck Pieces for cotyledon Summer Fashion Solid s Suit Spring Scoop cotyledon 2 Women Color Neck for Scoop Sleeve Solid Summer Dresses 4 s Fashion 3 Spring Suit Pieces Dress

Solid Dresses s 4 Summer Pieces Spring Dress Suit Sleeve 2 Color Scoop Neck 3 Women Fashion for cotyledon SPnqX1P

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