Sleeves Long fit Bodycon Collar Midi DD Short Skirt Pink Turndown s Dress Women Slim UP wnxCq81z
Evening Formal Gown s Party Dresses Long Women Prom Red Strapless Dow Satin DKBridal Strapless Long s Party Red Dow Dresses Prom DKBridal Gown Formal Evening Women Satin

Gown Women DKBridal Red s Dresses Long Formal Evening Dow Party Prom Strapless Satin AnqCS

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