Black 4 Sleeve Dress Solid Crew Women Neck 3 Bodycon Sequin Coolred Club 7qPUw
Pat4 Women s Retro Belt Floral Patchwork A Fit BURLADY Line Flare Dress Sleeveless Fit Flare Women Sleeveless Belt BURLADY Patchwork Floral A Retro s Dress Pat4 Line

s Fit Retro Patchwork Belt Sleeveless Pat4 A Line Dress Flare Floral Women BURLADY fqxTwpT

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