Question: What is the difference, if any, of the resulting code logic based on these two provider configurations?
- 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.
Answer: The correct answer of the above question is Option B: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.