Question · Angular course · Module 5: Services and DI

Advantage of inject()

According to the lesson, what advantage does the inject() function have over constructor injection?

Answer options

  • It is the only way to inject services
  • It can be used in functions and handles inheritance more easily
  • It automatically creates unit tests
  • It does not require an import from @angular/core

You can check the correct answer by solving this task in the CodeWorlds game.