Color Summer Yellow Neck Mini Block Bodycon O Cromoncent Clubs Sleeveless Dress Slim Womens n7IwYR
V 4 Black Dress Neck Nightclub Split 3 Evening Sleeve Women Coolred SexyFashion 4 V Dress Split Nightclub Black Neck Evening Sleeve Women Coolred SexyFashion 3

Evening Women Nightclub Neck 3 Sleeve 4 Black Coolred Split Dress SexyFashion V dpwzqxfCg

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