Cotton WEILAI Dress Women Pack Funny Cartoon SOCKS Cute Socks Color Fashion 5 s 5 Design Girl rUAHr7q
Dress Bridal Prom Champagne Short Junior Chiffon Lace Women Evening Drasawee Neckline Lace Dress Evening Short Chiffon Neckline Junior Women Drasawee Prom Bridal Champagne

Drasawee Champagne Short Lace Prom Dress Evening Chiffon Bridal Neckline Women Junior wSTgqZ

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