我正在尝试使用角度为1.5.5的角度材料1.5.5。我的代码如下所示:
的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"
}
}
但不知怎的,它给了我这个错误:
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
答案 0 :(得分:2)
在您的应用内注入ngAria
,ngMessages
和ngAnimate
答案 1 :(得分:2)
如果您使用的是AngularJS版本 1.6.5 ,则需要使用相同版本的angular-aria
,angular-animate
等。
因此,将angular-message
,angular-aria
和angular-animate
的版本从 1.5.5 升级为 1.6.5 。