12 Dress Beachwear Plus Sling Sun Women Size Buttoned Patterned Coolred Sexy xHv7g
Loose Button Womens Linen Gray Striped Cromoncent Shirt Casual Pendulum up Sleeveless Dress Big Loose Casual Cromoncent Striped Shirt Linen Pendulum Sleeveless Gray Womens Dress Button Big up

up Pendulum Button Sleeveless Loose Gray Big Dress Linen Striped Womens Cromoncent Shirt Casual zwfxA10

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