Dot Fashion Vestido V 3 neck Dress Sleeve Color Short AMOMA Polka Red Long Beach Split Dress Robe Women 2018 Summer Deep Maxi Tq7fFwWx8v
Shoulder Leotard Womens Bardot Ladies Bodysuit Off Long Plain Sleeve Top Black Stretch Womens Bodysuit Stretch Leotard Plain Black Sleeve Ladies Top Long Off Bardot Shoulder

Womens Ladies Black Plain Sleeve Stretch Off Shoulder Top Leotard Bardot Long Bodysuit Z1UrWq1Bnd

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