DreHouse Prom Gowns 2 Pieces Black High Low Beaded Party s Crystal Dresses Women 4TqrHw4Wa
Drawstring V Floral Women Waist Bewish Sleeve Chest Mini Up Bohemian Print 3 Adjustable 4 Button Neck s Beach Brown Dress Sleeve Print Chest Bohemian s Dress Up Adjustable Drawstring Brown 3 Floral Button 4 Mini Bewish Beach V Women Neck Waist

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