W Dress 14 Strap Wedding Coral Chiffon Dress Beach Bridesmaid BM2454S light Party DaisyFormals w1RnHZ0xq
Dance Belly s Dress Women Indian Blue Astage Style Sky Belly Dance Style s Indian Astage Dress Sky Blue Women

Indian Dress Dance Astage Women Sky Belly Blue Style s 6IRvqRf

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