Thursday, September 20, 2018
AliDropship is the best solution for drop shipping

In previous article we discussed about form update ,for this we used services, most of the developers getting common errors while injecting the service in controllers. Now we will discuss
a common error as shown below.
Error: $injector:unpr Unknown Provider
To resolve this we need to check three things let’s check those three now.

Need to define the service and check spelling, before we inject into controller
Here we will check code which makes unknown provider error.

In the above code we defined the forumFactory service in editRegistration controller which will cause injector error due to service which is not defined in the app.js file. To fix this error we need to create the service which we defined in editRegistration controller as below.

Creating multiple angular modules in same app. js file, will cause the error.
If we define two angular modules in same app.js which leads to error, code looks like below

In the above code we defined welcome module two times it will causes , Error: $injector: unpr Unknown Provider. To fix these error we need to define single angular module as below.

Trying to inject one controller into another controller, will cause the error.
Now let’s check the code which causes the error.

We should not inject controller into another controller,scope object into anything ,that’s not a controller or a directive .For example a service will cause , Error: $injector: unpr Unknown Provider. It will consider as service mistakenly let’s check the below code which causes error.

Thanks for reading this article, for any queries please use comment system, subscribe for eknowledgetree for new and fresh articles.

I am Saritha Reddy, a Remote codeigniter,Angularjs Developer. I have 4+ years of strong experience in designing, implementing, Programming and delivering advanced XAMPP ( Apache, MySQL and PHP) Web applications development. I am an Indian national and based Andhra Pradesh,Hyderabad. In addition to providing custom programming and design, I also have extensive experience with Open Source technologies to keep costs down and get websites running with as little fuss and wait as possible.


Leave a Comment