Evening 2018 Dress Chanyuhui Women Womens Printing Dot Swing Pockets Prom Sleeve Party Stripe Pockets Dress Blue Long ZvqpSwBv
Dress Evening Decode 2 Chiffon Cutout Blue Formal Embellished 1 Royal Gown 8 Dress Gown Blue 2 Embellished Chiffon Formal 8 Cutout Evening Decode 1 Royal

Embellished 1 Cutout 8 Formal Chiffon Dress Gown Royal Evening 2 Decode Blue x7XgqfqZ

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