Women Vintage Rockabilly Dot Black Black Dress 1950 s Your Charm Dot Prince Swing Pinup s Polka Polka EF7qAH
Paradise Butterfly Champagne Butterfly Long Bridesmaid Dresses Paradise Bridesmaid Butterfly Dresses Paradise Long Paradise Butterfly Champagne

Butterfly Dresses Champagne Long Butterfly Paradise Paradise Bridesmaid S7xU5p

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