Print Maxi Party Dress 1 Jaycargogo Leopard Fashion Spaghetti Women Strap Cocktail nC1OqCSg
Strapless David Bridal Chiffon s Bellini Pleated F15555 Long Dress Bodice Style Bridesmaid Bridesmaid Long Bridal Bellini Chiffon David Bodice s F15555 Dress Style Strapless Pleated

Bodice Long Style Bellini Bridal s F15555 Bridesmaid Strapless Pleated Chiffon David Dress BfAUn

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