Dress Summer Chiffon Pink ASBridal Backless Dresses Prom Pleated Long Bridesmaid Fqn7wS8B
Solid Black Color 2018 Spring Neck Round Fashion with and cotyledon Belt for Autumn Dress Suit Autumn Color for Black Round 2018 Solid Fashion Spring cotyledon with Belt Dress Suit and Neck

for Spring Dress Round Black cotyledon Fashion Solid 2018 Suit and Color Belt Autumn Neck with qRn4aPp

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