Friday 19 May 2017

Issue with angularJS npm packages and dependencies

This is the error I get

 angular.js:38 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.6.4/$injector/modulerr?p0=myApp&p1=Error%3A%2…arJS%2Fangular-my-app%2Fnode_modules%2Fangular%2Fangular.min.js%3A22%3A179)
        at angular.js:38
        at angular.js:4920
        at q (angular.js:403)
        at g (angular.js:4880)
        at eb (angular.js:4802)
        at c (angular.js:1914)
        at Sc (angular.js:1935)
        at ue (angular.js:1820)
        at angular.js:33367
        at HTMLDocument.b (angular.js:3431)

This is what angular.js line 38 looks like (the very first line starting with function minErr...)

function minErr(module, ErrorConstructor) {
  ErrorConstructor = ErrorConstructor || Error;
  return function() {
    var code = arguments[0],
      template = arguments[1],
      message = '[' + (module ? module + ':' : '') + code + '] ',
      templateArgs = sliceArgs(arguments, 2).map(function(arg) {
        return toDebugString(arg, minErrConfig.objectMaxDepth);
      }),
      paramPrefix, i;

    message += template.replace(/\{\d+\}/g, function(match) {
      var index = +match.slice(1, -1);

      if (index < templateArgs.length) {
        return templateArgs[index];
      }

      return match;
    });

    message += '\nhttp://errors.angularjs.org/1.6.4/' +
      (module ? module + '/' : '') + code;

    for (i = 0, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
      message += paramPrefix + 'p' + i + '=' + encodeURIComponent(templateArgs[i]);
    }

    return new ErrorConstructor(message);
  };
}

I think this error is a result of how I'm calling the angularJS library and several other angularJS npm packages.

Here are the heads tags in my html..

  <head>
    <title> Library </title>
    <link href="https://s3.amazonaws.com/codecademy-content/projects/bootstrap.min.css" rel="stylesheet" />
    <link href='https://fonts.googleapis.com/css?family=Roboto:500,300,700,400' rel='stylesheet' type='text/css'>
    <link href="css/style.css" rel="stylesheet" />

    <!-- AngularJS library -->
 <!--  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script> -->
 <script src="./node_modules/angular/angular.min.js"></script>
<!-- shim is needed to support non-HTML5 FormData browsers (IE8-9)-->

<script src="./node_modules/angular-route/angular-route.js"></script>

<script src="./node_modules/ng-file-upload/dist/ng-file-upload-shim.min.js"></script>
<script src="./node_modules/ng-file-upload/dist/ng-file-upload.min.js"></script>

  </head>

And here is where I call my dependencies..

var app = angular.module("myApp", [ 'ngRoute', 'angularFileUpload',]);

I am fresh out of ideas on where the error could possibly be. Any thoughts?



via Arron J. Linton

No comments:

Post a Comment