Lace Round Casual Neck Dress Long Women Trim As1 Coolred Mini Sleeve wYqax
Floral Loose Long Beach Long Swing antaina Sleeve Dress White Boho Print Wrap Party Boho Sleeve Long antaina Swing Dress Long Floral Beach Print White Wrap Party Loose

Dress Long Loose antaina Swing Party Sleeve White Wrap Boho Beach Long Print Floral X1Xxfz

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