angular 1.5.5 material design gives me Unknown pro

2019-08-14 16:34发布

I am trying to use angular material 1.5.5 with angular 1.6.5. My code is as shown below:

index.html

<!DOCTYPE html>
<html>

<head>
    <title>xyz</title>

</head>

<body ng-app="xyz">
    <ng-view></ng-view>
    <script src="bower_components/angular/angular.js"></script>
    <script src="bower_components/angular-route/angular-route.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="js/app.js"></script>
    <script src="js/config.js"></script>

</body>

</html>

app.js

angular.module('xyz', [
    'ngRoute',
    'ngMaterial',
    'ngAnimate'
]).
config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
        $routeProvider.
        when("/home", { templateUrl: "template/home.html", controller: "homeController" }).
        otherwise({ redirectTo: '/login' });
    }]);

bower.json

{
    "name": "xyz",
    "description": "",
    "main": "index.js",
    "authors": [
        "mjet"
    ],
    "license": "ISC",
    "homepage": "",
    "private": true,
    "ignore": [
        "**/.*",
        "node_modules",
        "bower_components",
        "app/bower_components",
        "test",
        "tests"
    ],
    "dependencies": {
        "angular": "~1.6.5",
        "angular-route": "~1.6.5",
        "angular-bootstrap": "~0.13.0",
        "bootstrap": "~3.3.5"
    },
    "resolutions": {
        "angular": "~1.6.x"
    }
}

But somehow it is giving me this error:

SCRIPT5022: [$injector:unpr] Unknown provider: $$HashMapProvider <- $$HashMap <- $$animateQueue <- $animate <- $compile <- $$animateQueue

http://errors.angularjs.org/1.6.6/$injector/unpr?p0=%24%24HashMapProvider%20%3C-%20%24%24HashMap%20%3C-%20%24%24animateQueue%20%3C-%20%24animate%20%3C-%20%24compile%20%3C-%20%24%24animateQueue

2条回答
别忘想泡老子
2楼-- · 2019-08-14 17:00

Inject ngAria, ngMessages and ngAnimate inside your app

查看更多
仙女界的扛把子
3楼-- · 2019-08-14 17:02

If your are using the version 1.6.5 of AngularJS, you need to use the same version of angular-aria, angular-animate and so on.

So upgrade the version of angular-message, angular-aria and angular-animate from 1.5.5 to 1.6.5.

查看更多
登录 后发表回答