What is the difference, if any, of the resulting code logic based on these two provider configurations?

    [ { provide: FormattedLogger, useClass: Logger }]
    [ { provide: FormattedLogger, useExisting: Logger }]
  •  They are the same. Both will result in a new instance of Logger that is bound to the FormattedLogger token.
  •  The useClass syntax tells the injector to make a new instance of Logger and bind that instance to the FormattedLogger token. The useExisting syntax refers to an already existing object instance declared as Logger.
  •  Both of them are wrong. A strong type connot be used for useClass or useExisting.
  •  They are the same. Both will result in the FormattedLogger token being an alias for the instance of Logger.

Leave a Reply

Your email address will not be published. Required fields are marked *