Plus Cover Swimwear s Women Dress Shirt Bikini T Beach up Size Beeshine Black Baggy EqFxAwEp
Sheath DKNY Ivory Print Dress Abstract DKNY Abstract Abstract Print Abstract Ivory Sheath DKNY DKNY Dress

DKNY Print DKNY Ivory Sheath Dress Abstract Abstract aTqgdwq4z

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