Dress Wright Carol Aqua Carol Wright Floral Ruffle Gifts wYEwnZx
Evening Chupeng Formal Dresses Dress Neck Lace V Long Mermaid Boat Back Prom s Red Ball Women Gown Ball Boat Long Dress Lace Dresses Red Chupeng Mermaid V Prom Formal Evening Neck Women Gown Back s

Chupeng V Evening Prom Formal Dress Back Gown Lace Women Boat Mermaid Red Ball s Dresses Long Neck wqrIRUxqfA

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