Women Partywear Anarkali Traditonal Kameez Ethnic Designer Deep Da Salwar Facioun Indian Blue 6 fwqIEI
Long Red Dresses Party s Evening Gown Prom Women Satin Formal DKBridal Strapless Dow Dresses Long Strapless DKBridal Red Gown s Evening Party Prom Satin Dow Women Formal

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