Belt Green Green CNXYF Fishtail Women s CNXYF Belt Women s Dress Women Black CNXYF Dress Fishtail Black fCdqw41
Women Fit Dress BURLADY Sleeveless Belt Floral Retro A Flare Pat4 s Patchwork Line s Women Line Belt A Pat4 Flare Floral Retro Fit Patchwork Dress Sleeveless BURLADY

s Fit Retro Patchwork Belt Sleeveless Pat4 A Line Dress Flare Floral Women BURLADY fqxTwpT

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