Slip Pleated A Flared Elegant Dress Sleeve Swing Pattern2 Printing Flounced Women Coolred Line qXS46wpZW
Shoulder 3 Ruffles 4 Women Off Sleeve Sexy Bodycon Domple Dress Black Mini Shoulder Dress Ruffles Sexy Sleeve 3 4 Bodycon Domple Off Black Mini Women

3 Dress Shoulder Bodycon Ruffles 4 Off Women Sleeve Sexy Black Domple Mini I4xRaqBv

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