Tony Archer Tony Archer - 1 year ago 77
AngularJS Question

Pulled out all my hair on an Angular unpr error

So I am getting an angular [$injector:unpr] error. Yes, I know what that normally means...I haven't defined something somewhere, or I am redefining the module over and over, or the like...but for the life of me I'm struggling to see the issue in my code.

I'm sure I'm missing something insanely basic, but after I've stared at code for a couple of hours, I go blind to it.

My HTML File:

<!DOCTYPE html>
<html ng-app="email">
<meta charset="UTF-8">
<link href=',100,300,500,700' rel='stylesheet' type='text/css'/>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="node_modules/angular/angular.min.js"></script>
<div ng-controller="EmailAuthController as auth">
<p>Request: [{{auth.request}}]</p>
<script type="text/javascript" src="js/controllers/email.js"></script>

file (As you can see, I've commented out some stuff to try to isolate the issue):

/* global angular parseGet */
function parseGet(val) {
var result = '', // = "Not found",
tmp = [];
var items ='&');
for (var index = 0; index < items.length; index++) {
tmp = items[index].split('=');
if (tmp[0] === val) {
result = decodeURIComponent(tmp[1]);
return result;

(function () {
.module('email', [])
.controller('EmailAuthController', [ '$scope','authFactory', function ($scope,authFactory) {
var vm = this,
req = parseGet('hash') || '';
vm.request = req;
// authFactory.validate(req)
// .then(function (response) {
// vm.response =;
// });
.factory('authFactory', [ '$rootScope', '$http', 'config', function ($rootScope, $http, config) {
var validate = function (hash) {
var url = config.SERVICE_URI + '/auth/email/' + hash;

return $http.get(url);

return {
validate: validate


Answer Source

From the code you've given it appears config is not defined in your authFactory injection.

.factory('authFactory', [ '$rootScope', '$http', 'config', function(a, b, c) {} ]); // config is not defined

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download