Black Womens Sleeve Outerwear Middle Dresses Size East Long Cardigan Zhhmeiruian Large Muslims Islamic Abaya Long 64RwqRgxC
Trousers Men Zhuhaitf Flat Front Dress Pocket Designer Formal Father Suit for Pants Trouser Pants Trousers Office Chino Gray Suit Zhuhaitf Front Father Flat for Formal Trousers Pocket Office Men Designer Gray Trousers Dress Chino Trouser Pants Pants

Pants Trousers Dress Office Men Pocket Father Gray for Flat Pants Front Trouser Zhuhaitf Chino Suit Designer Trousers Formal 7yqW5nO

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