Halter Karin Neck Grace Dot Cocktail 7 Dresses Color Vintage Belle Floral Polka A84qa
Sexy Neck Cromoncent Red Loose Dress Dots Swing Womens Spaghetti Strap Printed V Long Summer Cromoncent Dress Long Womens Swing Neck Loose Printed Dots Strap Summer Sexy V Red Spaghetti

Summer Long Cromoncent Spaghetti Dots Neck Dress Printed Red Womens Loose V Swing Strap Sexy IzrPYz

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