Thin Sleeve Wine Belt Cruiize Dress Pleated Red V Solid neck Womens Casual Long axTq0
Club Dress Plus Sleeveless Mulit Party 12 Printed Color Women Coolred Size Sun Sleeveless Mulit Color Coolred Printed 12 Club Dress Women Plus Sun Party Size

Sun Sleeveless Club Coolred Dress Women Party Printed Plus Mulit Size 12 Color TYFqA4

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