Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular JS console errors: line numbers don't refer to my source files

I am making my first Angular app and I'm trying to figure out how to use the errors displayed in the console to figure out where in my code things are breaking. Here is an example console error:

Error: [$injector:unpr] Unknown provider: HomeProvider <- Home
http://errors.angularjs.org/1.2.5/$injector/unpr?p0=HomeProvider%20%3C-%20Home
    at http://recipe-app/lib/angular/angular.js:78:12
    at http://recipe-app/lib/angular/angular.js:3519:19
    at Object.getService [as get] (http://recipe-app/lib/angular/angular.js:3646:39)
    at http://recipe-app/lib/angular/angular.js:3524:45
    at getService (http://recipe-app/lib/angular/angular.js:3646:39)
    at invoke (http://recipe-app/lib/angular/angular.js:3668:13)
    at Object.instantiate (http://recipe-app/lib/angular/angular.js:3689:23)
    at http://recipe-app/lib/angular/angular.js:6714:28
    at link (http://recipe-app/lib/angular/angular-route.js:897:26)
    at nodeLinkFn (http://recipe-app/lib/angular/angular.js:6168:13) <div ng-view="" class="full-screen ng-scope"> 

See how all the line numbers refer to lines within the angular.js file and not my source files? That leaves me guessing where my error is.

Note: I'm not looking for a solution to this specific error. I'm trying to figure out in general how to find the source of these errors using Angular.

I've installed Batarang already, but thats not showing me this error at all. Also, other SO answers show you how to manually log error information to the console by inserting code in specific places, but that assumes I have a general idea where it's coming from.

Thanks in advance, sorry for being dim.

like image 448
Jeremy Knight Avatar asked Jan 18 '14 17:01

Jeremy Knight


1 Answers

This happens when any of your services are not defined. So check if all your services are included to index.html. In your case I see that your Home service is not found.

like image 196
Jayram Avatar answered Nov 07 '22 19:11

Jayram