Dolce Jeri Dolce Ivory Card Vita Women Vita Dress s UxAn5qX
Patchwork Flare Women Line Belt Floral Retro Pat4 Fit BURLADY A Sleeveless Dress s Patchwork Flare Sleeveless s Retro BURLADY Dress Pat4 Fit Belt Women Floral A Line

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