Angular JS Unknown Provider Error

点点圈 提交于 2019-12-04 15:03:17
Tomek Sułkowski

If you have an error such as this:

Error: [$injector:unpr] Unknown provider: ResultsServiceProvider <- ResultsService <- ResultsController

It usually mean one of those things:

  • You've either misspelled the ResultsService name when creating (declaring) it.
  • Or you haven't inserted a script tag pointing to the file that contains the service in your index.html.
  • Or you've created the service within a certain module other than your main app module, but have forgotten to list this module as one of your app's dependencies (e.g. angular.module('myApp', ['moduleWithService']);)

So during debugging of this kind of error, you should always start from checking these 3 things.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!