title: Angular Error [$injector:modulerr] when loading module
body: <p>[Update] I've found the site works with Microsoft Edge just fine.  IE seems to be the only one having issues.</p>
  
  <p>So I've run into an issue where my site fails to load in Internet Explorer and throws this error:</p>
  
  <pre><code>[$injector:modulerr] Failed to instantiate module necs due to:
  Error: [$injector:modulerr] Failed to instantiate module necs.LandingModule.controller due to:
  Error: [$injector:nomod] Module 'necs.LandingModule.controller' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument
  </code></pre>
  
  <p>The site loads completely fine in both Firefox and Chrome, but refuses to load in Internet Explorer.  I'm not sure what the issue could be as the 'necs.LandingModule.controller' is both spelled correctly and loaded.  I've tried removing some of the code within the Controller to see if it would load, hoping that I could find exactly which piece of code IE doesn't like, but I've yet to be successful in doing that.  </p>
  
  <p>Let me know if you need more information and I will provide as needed.</p>
  
  <p><strong>CONTROLLER.JS</strong></p>
  
  <pre><code>angular.module('necs.LandingModule.controller', [
                       'necs.FeaturedItemsModule.directives'])
  .controller('LandingController', ['$scope', '$location', '$routeParams', '$window', 'ajaxUtil',
  function($scope, $location, $routeParams, $window, ajaxUtil){
  
    $scope.landingProducts = [1,2,3,4,5,6];
  
    $scope.getFeaturedProducts = function() {
      ajaxUtil.get('/api/landingProducts', $scope, 'onGetFeaturedProducts');
    };
  
    $scope.onGetFeaturedProducts = function(response) {
      if (response) {
        $scope.landingProducts = response.data;
      }
    };
  
    $scope.getCatalogMailer = function(id){
      if (id == 'link1'){
          $window.open("link");
      }else if(id == 'link2'){
          $location.url('link');
      }else if(id =='link3'){
          $location.url('link');
      }else if(id =='link4'){
          $location.url('link');
      }else if(id =='link5'){
          $location.url('link');
      }
    };
  
    $scope.getFeaturedProducts();
  
    ga('send', 'pageview', {
    'title': 'landing page'
    });
  }]);
  </code></pre>
  
  <p><strong>INDEX.HTML</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en" ng-app="necs"&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1.0"&gt;
      &lt;title&gt;NECS&lt;/title&gt;
      &lt;link rel="icon" type="image/png" href="assets/images/icon.png" sizes="32x32" /&gt;
  
      &lt;link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css"&gt;
      &lt;link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap-theme.min.css"&gt;
      &lt;link rel="stylesheet" href="/css/app.css"&gt;
      &lt;link href='https://fonts.googleapis.com/css?family=Oswald:300,400,700' rel='stylesheet' type='text/css'&gt;
  
      &lt;script src="/bower_components/angular/angular.js"&gt;&lt;/script&gt;
  
       &lt;script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular-cookies.js"&gt;&lt;/script&gt;
  
  
      &lt;script src="/bower_components/angular-route/angular-route.js"&gt;&lt;/script&gt;
      &lt;script src="/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"&gt;&lt;/script&gt;
      &lt;script src="/bower_components/angular-strap/dist/angular-strap.min.js"&gt;&lt;/script&gt;
      &lt;script src="/bower_components/angular-strap/dist/angular-strap.tpl.min.js"&gt;&lt;/script&gt;
      &lt;script src="/bower_components/angular-sanitize/angular-sanitize.min.js"&gt;&lt;/script&gt;
      &lt;script src="/bower_components/jquery/dist/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script src="/bower_components/bootstrap/dist/js/bootstrap.min.js"&gt;&lt;/script&gt;
      &lt;script src="/bower_components/angularUtils-pagination/dirPagination.js"&gt;&lt;/script&gt;
  
      &lt;script src="/js/app.js"&gt;&lt;/script&gt;
      &lt;script src="/js/controllers.js"&gt;&lt;/script&gt;
      &lt;script src="/js/directives.js"&gt;&lt;/script&gt;
      &lt;script src="/js/services.js"&gt;&lt;/script&gt;
      &lt;script&gt;
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  
        ga('create', 'UA-67702514-1', {
          'cookieDomain': 'none'
        });
    &lt;/script&gt;
  
    &lt;base href="/" /&gt;
  
    &lt;/head&gt;
    &lt;body data-spy="scroll" data-offset="15"&gt;
      &lt;div class="container"&gt;
        &lt;header-directive&gt;&lt;/header-directive&gt;
        &lt;div ng-view &gt;
        &lt;/div&gt;
      &lt;/div&gt;
        &lt;div class="main-footer"&gt;
          &lt;div class="container"&gt;
            &lt;footer-directive&gt;&lt;/footer-directive&gt;
          &lt;/div&gt;
        &lt;/div&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>LANDING.HTML</strong></p>
  
  <pre><code>&lt;div class="landing row"&gt;
    &lt;div class="row"&gt;
      &lt;div class="col-xs-12"&gt;
        &lt;div class="well"&gt;
          &lt;custom-order-directive&gt;&lt;/custom-order-directive&gt;
          &lt;featured-items-directive&gt;&lt;/featured-items-directive&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  
   &lt;div class="row"&gt;
    &lt;div ng-repeat="item in landingProducts" class="col-sm-12 col-md-4"&gt;
      &lt;div class="thumbnail main-container"&gt;
        &lt;div class="image-container"&gt;
          &lt;!--&lt;img ng-click="onProductClick(item.id)" class="top-sellers" ng-src="{{item.img}}" /&gt;--&gt;
          &lt;img ng-src="{{item.image}}" /&gt;
        &lt;/div&gt;
          &lt;div class="caption text-center landinglinks"&gt;
          &lt;h3 &gt;{{item.header}}&lt;/h3&gt;
          &lt;!--&lt;p ng-bind-html="item.text" ng-click="onProductClick(item.link)"&gt;&lt;/p&gt;--&gt;
          &lt;p ng-bind-html="item.text" ng-click="getCatalogMailer(item.link)"&gt;&lt;/p&gt;
    &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>FRONT APP.JS</strong></p>
  
  <pre><code>angular.module('necs', ['ngRoute',
                          'necs.LandingModule.controller',
                          'necs.CustomModeModule.controller',
                          'necs.CustomOrderModule.controller',
                          'necs.CustomPdfModule.controller',
                          'necs.CatalogModule.controller',
                          'necs.ProductModule.controller',
                          'necs.HeaderModule.directives',
                          'necs.FooterModule.directives',
                          'necs.MenuModule.directives',
                          'necs.DownloadsModule.controller',
                          'necs.InformationModule.controller',
                          'necs.LoginModule.controller',
                          'necs.AccountModule.controller',
                          'necs.AdministrationModule.controller',
                          ])
  .config(['$routeProvider', function($routeProvider) {
    $routeProvider
      .when('/', {
        templateUrl: 'html/landing.html',
        controller: 'LandingController'
      })
      .when('/customMode', {
        templateUrl: 'html/customMode.html',
        controller: 'CustomModeController'
      })
      .when('/customOrder', {
        templateUrl: 'html/customOrder.html',
        controller: 'CustomOrderController'
      })
      .when('/customPdf', {
        templateUrl: 'html/customPdf.html',
        controller: 'CustomPdfController'
      })
      .when('/catalog', {
        templateUrl:'html/catalog.html',
        controller: 'CatalogController'
      })
      .when('/catalog/product', {
        templateUrl: 'html/product.html',
        controller: 'ProductController'
      })
      .when('/downloads', {
        templateUrl: 'html/downloads.html',
        controller: 'DownloadsController'
      })
      .when('/information', {
        templateUrl: 'html/information.html',
        controller: 'InformationController'
      })
      .when('/cart', {
        templateUrl: 'html/cart.html',
        controller: 'CartController'
      })
      .when('/login', {
        templateUrl: 'html/login.html',
        controller: 'LoginController'
      })
      .when('/account', {
        templateUrl: 'html/account.html',
        controller: 'AccountController'
      })
      .when('/administration', {
        templateUrl: 'html/administration.html',
        controller: 'AdministrationController'
      })
      .otherwise({
        redirectTo: '/'
      });
  
  }]);
  </code></pre>
  
  <p><strong>SERVER APP.JS</strong></p>
  
  <pre><code>var express = require('express');
  var path = require('path');
  var mongoose  = require('mongoose');
  var session = require('express-session');
  var bodyParser = require('body-parser');
  var flash = require('connect-flash');
  var nodemailer = require('nodemailer');
  var exphbs  = require('express-handlebars');
  var hbs = require('nodemailer-express-handlebars');
  var db = require('./db')();
  var user = require('./user')();
  var fs = require('fs');
  var Cookies = require('cookies');
  
  var Product = require('./product');
  var Category = require('./category');
  var Download = require('./download');
  var Codes = require('./codes');
  var Specsheet = require('./specsheet');
  var app = express();
  
  app.use(express.static(path.resolve(__dirname + '/../front/static')));
  
  app.use(bodyParser.urlencoded({limit: '50mb'}));
  app.use(bodyParser.json({limit: '50mb'}));
  
  app.get('/qr/:qrcode', function (req, res) {
      var domain = 'domain.com/#/qr/';
      var qrcode = req.params.qrcode;
  
      res.redirect(domain+qrcode);
  });
  
  //login
  app.use(flash());
  
  app.get('/', function(req, res) {
    res.sendfile('index.html');
  });
  
  // parse application/json
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: false }));
  var server = app.listen(80);
  
  var config = {
    "USER": "user",
    "PASS": "password",
    "HOST": "127.0.0.1",
    "PORT": "22222",
    "DATABASE" : "database"
  };
  
  var dbPath  = "mongodb://" + config.USER + ":"+ config.PASS + "@"+ config.HOST + ":"+ config.PORT + "/"+ config.DATABASE;
  mongoose.connect(dbPath);
  
  db = mongoose.connection;
  db.on('error', console.error.bind(console, 'connection error:'));
  db.once('open', function callback () {
      console.log('connected successfully');
  });
  
  
  //landing products
  app.get('/api/landingProducts',function(req,res) {
  
    var landingItems = {
        landing1: {
            image: "/assets/images/landing1.jpg",
            text: "text1",
            header: "header1",
            link: "link1"
        },
        landing2: {
            image: "/assets/images/landing2.jpg",
            text: "text2",
            header: "header2",
            link: "link2"
        },
        landing3: {
            image: "/assets/images/landing3.jpg",
            text: "text3",
            header: "header3",
            link: "link3"
        },
        landing4: {
            image: "/assets/images/landing4.jpg",
            text: "text4",
            header: "header4",
            link: "link4"
        },
        landing5: {
            image: "/assets/images/landing5.jpg",
            text: 'text5',
            header: "header5",
            link: "link5"
        },
        landing6: {
            image: "/assets/images/landing6.jpg",
            text: "text6",
            header: "header6",
            link: "link5"
        }
    };
  
    res.send(landingItems);
  
  });
  </code></pre>