Error: $injector: unpr Unknown Provider

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.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

welcome.factory("forumFactory",['$http',function($http){

return{

getID:function(id)

{

return$http({

url:'http://localhost:81/Codeigniter/index.php/welcome/getID/'+id,

method:'GET'

});

}

};

}]);

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

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.

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.