Crinkle Bridesmaid F19446 Crinkle malibu Shoulder Chiffon Chiffon One Style Dress RXdP8dx
Print Jaycargogo Tiger Party Women Halloween Khaki Loose s Dress Jaycargogo Khaki Print Loose Tiger s Dress Women Party Halloween

Khaki Party Loose Jaycargogo Women Print Dress Tiger s Halloween UaFgKyac

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