length Applique for Applique SoarDream Crystal belt Wedding Princess Trim Silver DIY Wedding Dress Fashion Rhinestone 45cm Craft qwwA4Fa
7 Bridesmaid lavender Neckline Chiffon DaisyFormals Vintage Dress Party BM1552 Dress Scoop Scoop Chiffon Neckline BM1552 lavender Vintage Party DaisyFormals Bridesmaid Dress 7 Dress

7 Chiffon lavender Party Dress Neckline Vintage DaisyFormals Bridesmaid Dress Scoop BM1552 xqz4OXwPnF

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