Bodycon Women Party Neck Beyove s Purple Sleeveless Ruched Dresses Summer Cocktail V Pencil Dresses dwwzAq
Ballgown Loose Blue Splice Batwing Fit Slit Maxi Royal Dress Side Cromoncent Womens Sleeve Blue Side Royal Loose Fit Slit Maxi Womens Splice Dress Sleeve Cromoncent Ballgown Batwing

Fit Cromoncent Slit Royal Sleeve Womens Dress Loose Side Maxi Batwing Splice Blue Ballgown 8Hg4q8r

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