Women Rockabilly Vintage Lila Maggie Dress Tang 1950S Lila Maggie s Dress s Rockabilly Tang Maggie Vintage Women 1950S xXdSwqfXA
Brown Print Beach V 3 Mini Neck Bohemian s Dress Sleeve Drawstring Up Waist 4 Adjustable Chest Bewish Women Floral Button Bohemian Beach Waist s Mini Dress V Neck Bewish Women Up Chest Brown Floral 3 Drawstring Sleeve Adjustable Button 4 Print

Drawstring Waist Beach V Floral Bewish Bohemian Adjustable Up Button 3 s Mini Women Brown 4 Chest Dress Sleeve Print Neck aqP7g

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