Bifast Women Wrap Vintage Red Chiffon Dress Deep Neck Long V Maxi Floral Print Split rrwqgC
Sweater White Beach Sleeve Shoulder Comfy Maxi V Neck Dress Long Women Off Long Maxi Shoulder Women Beach V Neck Sleeve Dress White Off Comfy Sweater

Maxi Beach Sleeve Women Shoulder Sweater V Off Neck White Long Comfy Dress xUwEz8x

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