Multi Sleeveless Women s Sheath Calvin Klein Cream Dress Block Cypress Color C6qnv4T
Party Formal Elegant Short Gown Ivory MACloth Cap Bridesmaid Sleeves Dress Wedding Short Party Elegant Sleeves MACloth Bridesmaid Formal Gown Ivory Cap Dress Wedding

Wedding Dress Sleeves Party Bridesmaid Cap Ivory Gown Formal MACloth Elegant Short wZCYYq

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