Sleepwear Clothing Pajama Clothes Night Puppy Pajamas Shirt Cat Jumpsuit Pet Dog ROSENICE Dress wqSp1YUx
Dress Printed 8 Summer Women Sun Floral Flower 22 Sleeveless New Multicoloured Sheering Ladies Mini Mini Dress Sun Multicoloured Floral New Sleeveless Flower Printed Sheering Women Ladies 22 Summer 8

Mini 22 Summer Multicoloured Flower Sleeveless Ladies Printed Dress New 8 Sun Floral Sheering Women g7CWRI

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