Allegra Party Mini Blue K Line Exposed Zipper Strapless s Front Women A Dress qf8rqR
4 Adjustable Button Chest Dress Waist Beach Drawstring Print Bohemian Brown Mini V Neck 3 Bewish Women s Sleeve Floral Up Bohemian Waist Brown Neck 4 Floral 3 Women V Print Beach Bewish Mini Up Dress Sleeve Drawstring s Button Chest Adjustable

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