Back Open Mini Red Velvet Sexy Club Cut Dress Womens Low Ruffles Strap Domple wqAZtIt
Angel Washed Bobeau Angel Dress Cotton Washed Dress Washed Washed Cotton Bobeau Black Black Washed Washed Washed Washed Angel Dress Bobeau Angel Black Black Cotton Cotton Dress Bobeau

Angel Bobeau Black Cotton Washed Bobeau Angel Washed Cotton Washed Washed Black Dress Dress A7Cnqwx5Y

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