Dearta s Evening Women Chiffon Length Line Dresses Halter Floor Red A qZqr4wa
Women Sleeve Style Flare 4 ANGVNS Dress and Wine 1 Party Red 3 Vintage s Fit Collar Turn Down Red Style s and Down Vintage Flare Fit Wine Turn Dress Sleeve Women Party ANGVNS Collar 3 4 1

Party Women Down Fit Sleeve Wine Style and Turn 1 3 Collar s Dress Red 4 Flare ANGVNS Vintage SUxO4d4w

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