Dresses Red Shirts Solid Blouses Women Cut Evening Strapless Coolred Out 8UC6W44
Dresses Purple Guest V Medium Neck Country Bridesmaid Chiffon Party Short Dressyu Wedding Gown Short Dressyu V Bridesmaid Medium Guest Dresses Purple Gown Neck Country Party Wedding Chiffon

Short Chiffon Country V Guest Dressyu Purple Neck Wedding Dresses Bridesmaid Party Gown Medium p5nw6

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