javascriptangularjsbowerangularjs-module

Uncaught Error: [$injector:unpr] Unknown provider:


I'm currently getting this error trying to load my Angular App:

Uncaught Error: [$injector:unpr] Unknown provider: $$HashMapProvider <- $$HashMap <- $$animateQueue <- $animate <- $compile <- $$animateQueue http://errors.angularjs.org/1.6.4/$injector/unpr?p0=%24%24HashMapProvider%2…eQueue%20%3C-%20%24animate%20%3C-%20%24compile%20%3C-%20%24%24animateQueue

The link in the error just tells me I spelled something wrong, but after quadruple checking, that's not the issue here. Here is my bower.json file:

{
  "name": "angular-seed",
  "description": "A starter project for AngularJS",
  "version": "0.0.0",
  "homepage": "https://github.com/angular/angular-seed",
  "license": "MIT",
  "private": true,
  "dependencies": {
    "angular": "^1.6.4",
    "angular-route": "~1.5.0",
    "angular-loader": "~1.5.0",
    "angular-mocks": "~1.5.0",
    "html5-boilerplate": "^5.3.0",
    "angular-animate": "^1.6.4",
    "angular-material": "^1.1.4"
  }
}

Here's my angular.module that's the same in both my view1.js and view2.js

(function() {
    var module = angular.module("myApp.view2", [
    "ngRoute",
    "ngMaterial",
    "ngAnimate",
    "ngAria",
    "ngMessages",
    "mdPickers"
  ]); 

  module.config(['$routeProvider', function($routeProvider) {
    $routeProvider.when('/view2', {
      templateUrl: 'view2/view2.html',
      controller: 'View2Ctrl'
    });
  }]);

  module.controller("View2Ctrl", ['$scope', '$mdpDatePicker', '$mdpTimePicker', function($scope, $mdpDatePicker, $mdpTimePicker){
    $scope.currentDate = new Date();
    // controller code
  }]);
})();

index.html

<!DOCTYPE html>
<!--[if lt IE 7]>      <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html lang="en" ng-app="myApp" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en" ng-app="myApp" class="no-js"> <!--<![endif]-->
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>My AngularJS App</title>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="bower_components/html5-boilerplate/dist/css/normalize.css">
  <link rel="stylesheet" href="bower_components/html5-boilerplate/dist/css/main.css">
  <link rel="stylesheet" href="app.css">
  <script src="bower_components/html5-boilerplate/dist/js/vendor/modernizr-2.8.3.min.js"></script>
</head>
<body>
  <!--[if lt IE 7]>
      <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
  <![endif]-->


  <ul class="menu">
    <li><a href="#!/view1">view1</a></li>
    <li><a href="#!/view2">view2</a></li>
  </ul>


  <div ng-view></div>

  <div>Angular seed app: <span app-version></span></div>

  <script src="bower_components/angular/angular.js"></script>
  <script src="bower_components/angular-route/angular-route.js"></script>
    <!-- Angular Material requires Angular.js Libraries -->
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-animate.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-aria.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-messages.min.js"></script>
  <!-- Angular Material Library -->
  <script src="https://ajax.googleapis.com/ajax/libs/angular_material/1.1.0/angular-material.min.js"></script><script src="app.js"></script>
  <script src="https://cdn.rawgit.com/alenaksu/mdPickers/0.7.4/dist/mdPickers.min.js"></script>
  <script src="view1/view1.js"></script>
  <script src="view2/view2.js"></script>
  <script src="components/version/version.js"></script>
  <script src="components/version/version-directive.js"></script>
  <script src="components/version/interpolate-filter.js"></script>
</body>
</html>

I also have a package.json for my node dependencies. That doesn't seem to be part of this particular issue, but I can add in that code if requested.

I've seen and asked this question asked before, but none of the offered solutions helped, so I'm asking on my own now.

Here is the github. The version throwing me errors is currently on the Master Branch. https://github.com/eanzalone/AngularDatePicker


Solution

  • Make sure you are using appropriate versions Update your bower.json to use 1.5.0 version of angular

    {
      "name": "angular-seed",
      "description": "A starter project for AngularJS",
      "version": "0.0.0",
      "homepage": "https://github.com/angular/angular-seed",
      "license": "MIT",
      "private": true,
      "dependencies": {
        "angular": "^1.5.0",
        "angular-route": "~1.5.0",
        "angular-loader": "~1.5.0",
        "angular-mocks": "~1.5.0",
        "html5-boilerplate": "^5.3.0",
        "angular-animate": "^1.5.0",
        "angular-material": "^1.1.4"
      }
    }
    

    add the scripts from the bower components itself